An extended queue abstract data type where each element possesses an associated priority level. Elements with higher priority are dequeued ahead of lower priority items.
Unlike standard FIFO queues where arrival sequence dictates service order, priority queues service critical tasks first. Fundamental applications include Dijkstra's Shortest Path, A* Search, Prim's MST, and OS real-time process interrupt handlers.
Queue is empty
High-priority items (marked with P) are maintained ahead of standard items, guaranteeing expedited service.
Elements sharing equal priority maintain relative FIFO ordering among themselves.
While implemented here as an ordered array, production systems typically utilize Binary Heaps to achieve O(log n) enqueue.
Network packet routing (QoS), emergency room triaging, discrete event simulation, and bandwidth throttling.