Answers for "C++ accessing in priority queue"

C++
0

C++ accessing in priority queue

/* Program to access an element of highest priority */
 
#include<iostream>
#include<queue>     //Header-file for queue
using namespace std;
 
 
int main()
{
priority_queue<int> p1;
p1.push(35);    
p1.push(40);
p1.push(95);
p1.push(25);
  
cout<<p1.top();      //fetch element of highest
priority(maximum element) i.e 95
}
Posted by: Guest on July-28-2021

Code answers related to "C++ accessing in priority queue"

Browse Popular Code Answers by Language