Comparator Sort
Learnings
Intuition
comp(a,b) == true
Means a is before b is correct ordering
Now,
if comp(a,b) == true, then comp(b,a) == false and comp(a,a) == false;
Hence
comp(a,b){
return a<=b
// Gives error, because it is confused between a->b or b->a, both returns true
}
Links
Last updated