Regarding person compare class

in this when a.age>b.age is done then younger ones are coming above according to oldest should come first.

Here when a.age>b.age is used…then it would form a min heap based on age. That is younger one would be at the top of the heap. When a.age<b.age is used…then a max heap is formed. Try to remember this.


You can refer this and check.

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.