links: Algorithms MOC
What is PriorityQueue
Priority Queue is an Abstract Data Tree (ADT) that operates similar to a normal queue except that each element has a certain priority . The priority of the elements in the priority queue determines the order in which elements are removed from the PQ.
Note: It supports only those elements that are comparable. Hence priority queue arranges the elements in either ascending or descending order.
Characteristics of Priority Queue
- Each item has a priority associated to it.
- An item with the highest priority is moved to the front and deleted first
- If two elements share the same priority value, then the priority queue follows the first-in-first-out principle for dequeue operation
How can you implement priority queue
tags: priority-queue queue
source: