0

I don't understand why using greater makes the minimum element on the top of the priority queue, can anyone explain this in detail?

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

ASF
  • 35
  • 2
  • That's just a convention. `less` produces the maximum element, `greater` produces the minimum one. – Evg Jun 25 '21 at 13:29

0 Answers0