Skip to content

Resource · Guide or article

Priority Queue

Defines the priority queue as an abstract type served by priority, and separates the concept from heaps, which are one way to build it.

Reviewed

Open the original: Priority Queue (opens the original site in a new tab)

Practice this topicOpens the practice interviewer in Technical / coding mode; choose a question there.

Add to a roadmap

Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.

Source content: English

Read this in other languages: 简体中文, Русский, 日本語, Français, Português, 한국어, Українська In computer science, a priority queue is an abstract data type which is like a regular queue or stack data structure, but where additionally each element has a "priority" associated with it. In a priority queue, an element with high priority is served before an element with low priority. If two elements have the same priority, they are served according to their order in the queue. While priority queues are often implemented with heaps, they are conceptually distinct from heaps. A priority queue is an abstract concept like "a list" or "a map"; just as a list can be implemented with a linked list or an array, a priority queue can be implemented with a heap or a variety of other methods such as an unordered array.

PrepKit overview

PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.

Suited to
The source does not state a level
Format
Reference

What it covers

  • Tie-breaking by queue order for equal priorities
  • Heap versus unordered array as possible implementations

How to use it

PrepKit study advice, not a claim made by the source.

Build a priority queue twice, once on an unsorted array and once on a binary heap, and compare how each handles inserting and removing the highest-priority item.

Scope and limitations

No operations list, complexity figures or examples. Everything beyond the definition is in the two external links.

Access and format

Short README on GitHub, trekhleb/javascript-algorithms (MIT), with seven translations. English, free.

Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 85293e3e2b88

Evidence behind this overview
  • src/data-structures/priority-queue/README.md

Pages that include this

Get the PrepKit newsletter

Optional. You don't need it to use PrepKit.

How we handle your email