int the code of car sorting problem in which distance was compared return d1<d2 was written how does it evaluate d1 corresponds to p1 and d2 to p2 and even when d1==d2 then p1.first < p2.first was used then also how does it compares and arrange in acending order please explain in detail.
Compare fn details that what does it actually return
hi @himanshuanand729 bhaiya has calculated distance first using p1 and p2
Now u check for the required condition
REFER IN GENERAL HOW IT WORKS
- return a<b : will return true when a is less than b, means a comes first when a <b… this is ascending order.
- return a>b: will return true when a is greater than b, means a comes first when a>b… this is descending order.