Skip to content

Commit 9e12b86

Browse files
priority Queue has been done
1 parent 07989b3 commit 9e12b86

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Heap/a.out

21 KB
Binary file not shown.

Heap/priorityQueue.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
author:gulshan yadav
3+
email: gulshany01@gmail.com
4+
date: 19-July-2021
5+
*/
6+
#include<iostream>
7+
#include<bits/stdc++.h>
8+
using namespace std;
9+
10+
11+
int main(){
12+
// this is max heap;
13+
priority_queue<int> pq;
14+
// this is min heap
15+
priority_queue<int, vector<int> , greater<int> > p;
16+
p.push(10);
17+
p.push(20);
18+
p.push(30);
19+
cout << p.top()<<endl;
20+
while(p.empty() == false){
21+
cout << p.top()<<" ";
22+
p.pop();
23+
}
24+
return 0;
25+
}

0 commit comments

Comments
 (0)