Comparator function doubt

Here Prateek bhaiya does not explain how compare function is executing.
What i mean to say is that if the compare function return " 0 " (as it returns bool value) for a>b or a<b…what happens after that???
Please explain it in detail.

hello @parth_tyagi

the comparator that bhaiya has designed will return true if a > b

otherwise it will return false.

now in case of true.
ss

the statement written inside if will execute and swapping will happen and after swapping elemets will be in correct order ( i.e a[j] < a[j+1])

in case of false if will not execute.

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.