Priority Queue

noun

say it: “pry-OR-ih-tee KYOO” /praɪˈɔrəti kjuː/

A line where the most important item comes out first, whatever order the items arrived in; usually built on a heap.

What is a priority queue?

A priority queue hands back the most important item next, whatever order the items arrived in, like an emergency room's waiting list. It's usually built on a heap, so adding and taking are O(log n). C# and Java have one built in, Python has the heapq module, and JavaScript has none.

In a sentence

  • “The emergency room's waiting list is a priority queue ordered by urgency, then arrival.”

Level: Journeyman · More Data Structures terms at this level

Updated