What do you mean by “sort( ) of < algorithm >”?
I must have clicked resolve by mistake
@Rohanaggarwal8590
sort function of header file < algorithm > .
It is a predefined function available to us which is extremely useful for sorting as it does it in O(n log n) time and O(1) space.
To use it with a vector , write
vector < int > v ;
--
//Take input into v
--
sort( v.begin() , v.end() ) ;
The vector v will be sorted in ascending order.
If you wish to sort it any other fashion , use a comparator function.
This function has been discussed in detail with the use of comparator functions as well in your course in the video titled “CPP - Inbuilt Sort Function” under Sorting and Searching video section.
Please refer to it.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.