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.

Syntax

Consider priority_queue 'pq' as a priority_queue object.

Parameter

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

Return value

None

Example 1

Output:

poping element  e d c b a

Example 2

Output:

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



Help Others, Please Share

facebook twitter pinterest