Introduction
Priority queues are a type of container adapters, specifically designed such that the first element of the queue is either the greatest or the smallest of all elements in the queue.
Priority queues are built on the top to the max or min heap and uses array or vector as an internal structure.
Advantages
- Quickly access to the highest priority item.
- Useful when trying to apply Prim's or Dijkstra's algorithm and for data compresson in Huffman code.
Disadvantages
- Insertion and deletion are very slow.