A priority queue is a special kind of queue, in priority queue we give some priority to an element and according to this priority an element can be served in the queue.

Generally, the value of element is treated as the priority of an element. Like, the element has highest value treated as the highest priority element as well as we assume that if element has lowest value treated as the highest priority element in the other case, we can give the priorities to elements according to our requirements.
If we talk about the normal queue works on first in first out rule whereas, in a priority queue element is removed according to the priority, an element with the highest priority is removed first.
There are two types of priority queue :
a Max-Priority Queue and a Min- Priority Queue. In these types, the priority queue stores the collections of elements and it is only able to provide the most “Extreme” element.
There are many ways to implement priority queue like, array, linked list, binary heap etc. If we talk about heap data structure then it provides an efficient way of implementing priority queues.
Complexity of Priority Queue : –
The operations of priority queues are inserting element, removing element, getting element. We are using Binary heap data structure for implementing of priority queue.
1. Add an new element into Priority Queue :
Here we are using max heap data structure for priority queue
2. Removing an element from the Priority Queue : –
3. Getting an element from the Priority Queue :
Return the root node without deleting the element of tree
Output : 

source