STL quiz question

Can you explain to me how the sort(a, a+5, greater()); works?

hello @niveditha_palli

among the first two parameters , the first one being the point of the array/vector from where the sorting needs to begin(in this case we starting from index 0) and the second parameter being the length up to which we want the array/vector to get sorted(in this case it is 5, that means first five elements will be considerred for sorting).
the third param is the comparator that we use to sort in particular order(in this case it is greater(), it will order elements in descending order).

so after calling this->

the first five elements will be in descending order)

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.