STL中优先级队列的用法

https://blog.csdn.net/stand1210/article/details/52464922

https://www.cnblogs.com/wangyingli/p/5967127.html

https://www.cnblogs.com/xzxl/p/7266404.html

https://blog.csdn.net/c20182030/article/details/70757660

 

 1 int main() {
 2     priority_queue<int> pq;
 3     priority_queue<int, vector<int>, greater<int>> pq1;
 4     //priority_queue<int, vector<int>> pq1;   输出从大到小
 5     int a[5] = { 50,12,80,95,112 };
 6     for (int i = 0; i < 5; i++)
 7         pq1.push( a[i]);
 8     for (int i = 0; i < 5; i++)
 9     {
10         cout << pq1.top() << endl;
11         pq1.pop();
12     }
13     system("pause");
14     return 0;
15 }

 

posted @ 2018-04-24 16:03  皇家大鹏鹏  阅读(75)  评论(0编辑  收藏  举报