Priority Queue Implementation

include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); priority_queue pq; pq.push(10); pq.push(20); pq.push(30); pq.push(40); pq.push(50); cout

Feb 18, 2025 - 02:27
 0
Priority Queue Implementation

include

using namespace std;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

priority_queue, greater> pq;
pq.push(10);

pq.push(20);
pq.push(30);
pq.push(40);
pq.push(50);

cout << pq.top() << endl;
pq.push(100);
pq.pop();
pq.pop();
cout << pq.top() << endl;

}