Comparator solve please

sir i want to make heap such that it become minheap
on on basis of first value if first value are same
than make on basis of second. second please
how to make comparaoter for this

the code is hear please correct https://ide.codingblocks.com/s/288015

The default minheap using STL will satisfy your condition. Make

priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>pq

It will make a min heap based on the first value of the pair. If first value is same then it makes according to the second value.

You can verify it from here https://ide.codingblocks.com/s/288023

sir i want if sort according if my pair<int,pair<int,int>>> a
is the element type in heap it sort on basese of a.first but if it i same
than it sort on a.second .seocnd not a.second .first how i write the comparator
for priority queue for this please help

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.