Sort function and comparators

how do we know that in comparators, a>b means it will be arranged in descending order and a<b means it will be arranged ascending order???
i am so confused!

compare function is called when you have to check whether two nos are swapped or not

if you return
return a<b
means return true if a is smaller
means smaller no comes first because it is swapped

whenever you want to swap you return true else false

i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved
if you have more doubts regarding this feel free to ask

if your doubt is resolved
please mark this doubt as resolved

or you have more doubts regarding this feel free to ask
otherwise mark it as resolved