why we have passed vector in priority queue declaration
Priority queue declaration
6:22 also unable to understand how comparator is sorting it in max heap form
how it is returning oldest person as comparision is a.age<b.age
@kartik-malik,
Because in STL, priority_queue is implemented using vectors, and that is how comparator works in priority_queue, if you reverse the inequality, the ordering will reverse, it is kind of a fact to remember.
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.
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.