Computing Atlas

How Computing Was Built
Sign In
Text size
100%
Theme
Concept

Double-ended priority queue

Data Structure

A double-ended priority queue, also called a DEPQ, double-ended heap or priority deque, is a data structure similar to a priority queue or heap that allows efficient removal of both the maximum and the minimum according to some ordering on the keys it stores. Every element carries a priority or value, elements can be removed in ascending as well as descending order, and the priority of an element can be changed after it has been inserted. The operations are isEmpty, size, getMin, getMax, put, removeMin and removeMax. A DEPQ can be built from balanced binary search trees, whose leftmost and rightmost leaves hold the minimum and maximum, from specialized structures such as the min-max heap, the pairing heap and the interval heap, or from two ordinary priority queues linked by the dual structure, total correspondence or leaf correspondence methods. One application is external sorting, where a DEPQ holds the middle group of elements in an external quick sort.

Facts
Partially Attested
Origin Year
1984 1
Year of the Carleton technical report (July 1984) presenting the min-max heap, one early implementation of a double-ended priority queue; the concept may be older.
Core Principle
Allow both FindMin and FindMax in constant time and Insert, DeleteMin and DeleteMax in logarithmic time 1
Sources
1. TR-55 An Efficient, Implicit Double-Ended Priority Queue (Carleton University)
  • Abstract
    A simple implementation of double-ended priority queues is presented.
  • Report date
    July 1984
View the Source
Double-ended priority queue (Wikipedia)
In Group: Tree Data Structures, Implementation
Quote, In Group: Tree Data Structures, Implementation
Double-ended priority queues can be built from balanced binary search trees
View the Source
Comments (0)
No comments yet. Be the first to share a thought.
Reader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.