Difference among these two expression

priority_queue<pi, vector, greater > pq;
and
priority_queue<pair<int, int> > pq;

hello @ride-code

here we are declaring max heap

here we are declaring min heap

does this vector make any change?

yeah its required. through that we are telling where the elements are stored.
its mandatory if we want to use min heap.

refer this for explanation of all three aruguments that we are passing in pq.

meanwhile for using min heap we have to use priority_queue<pi, vector, greater > pq; expression

yeah , . . …

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.