Skip to content

Files

Latest commit

3fa1967 · Jan 27, 2022

History

History
This branch is 88 commits behind trekhleb/javascript-algorithms:master.

priority-queue

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Apr 12, 2019
Mar 3, 2019
Aug 9, 2020
Apr 12, 2019
Jan 27, 2022
Jan 27, 2022
Apr 16, 2019
Dec 28, 2018
Aug 30, 2018

Priority Queue

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.

References