Javatpoint Logo
Javatpoint Logo

C++ priority_queue push()

C++ prioriy_queue push() function is used to insert an element into a priority queue. The element is added into the priority queue container then the size of the priority queue is increased by 1. Firstly, the element is added at the back and at the same time elements of the priority queue reorder themselves according to priority.


Consider priority_queue 'pq' as a priority_queue object.


Value: It is used to add value into a priority queue.

Return value


Example 1


poping element  e d c b a

Example 2


poping element:  my india Is Great Country
Next TopicC++ priority_queue

Help Others, Please Share

facebook twitter pinterest