Skip to content

Commit 1b1b656

Browse files
committed
priority_queue-in-c-stl added
1 parent c30785c commit 1b1b656

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

priority_queue.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
// max priority queue
7+
priority_queue<int> p1;
8+
p1.push(2);
9+
p1.push(3);
10+
p1.push(1);
11+
12+
cout << p1.top() << endl;
13+
14+
// min priority queue
15+
16+
priority_queue<int, vector<int>, greater<int>> p2;
17+
p2.push(4);
18+
p2.push(0);
19+
p2.push(30);
20+
21+
cout << p2.top() << endl;
22+
23+
return 0;
24+
}

0 commit comments

Comments
 (0)