Though we are making our own comparator which returns the age of minimum of two persons so why the output is coming in descending order instead it should be in ascending.
Priority Queue | Comparator Class
@S18LP0113 we are making comparator for priority queue on basis of age. if we want the oldest one we do a.age<b.age bigger age got the priority. sir has explained this in the video try watching it again.
i hope its clear if yes dont forget to mark the doubt resolved and hit like
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.