我正在尝试解决一个导致我为某些数据点创建最大和最小堆的问题。假设我有以下信息:
(10,100)
(30,120)
(14,110)
(18,200)
(20,230)
(13,49)
And I want to store these data points in a max and min heap, but I want the heaps made by their second value. However, I still need the first value preserved as I use it later in the program. How can I accomplish this task? What are the most efficient STL methods to always pop the max or always pop the min from a set of data points, while still preserving other, paired data?