What does sort do when Compare returns false

when we define a comparater as a bool
compare(int a,int b){
return a>b;
}
if it returns false
then what happens in to the sort function does it sort the elements
sort(a,b,compare);

Hello @abhayg1602, in this case compare function runs for every adjacent pair of elements and if it retuns the false in that case it swaps the elements.

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.