# binary priority queue

(data structure)

**Definition:**
A *priority queue* implemented with a *binary tree* having the following restrictions:

- The
*key* of a *node* is greater than keys of its *children*, i.e., it has the *heap property*. - If the right
*subtree* is not empty, the left subtree is not empty. - If there are both left and right children, the left child's key is greater than the right child's key.

**Generalization** (I am a kind of ...)

*priority queue*.

**Aggregate child** (... is a part of or used in me.)

*binary tree*, *heap property*.

**See also**
*leftist tree*, *heap*.

*Note:
The subtree restriction means that when inserting at a leaf, the left subtree is always used before the right subtree. Favoring the left subtree tends to make the tree taller and thinner. *

*
** After [GBY91, pages 223-225].*

Author: PEB

## Implementation

Gonnet and Baeza-Yates insert (C and Pascal) and delete (C and Pascal)

Go to the
Dictionary of Algorithms and Data
Structures home page.

If you have suggestions, corrections, or comments, please get in touch
with Paul Black.

Entry modified 16 November 2009.

HTML page formatted Fri Feb 23 10:06:07 2018.

Cite this as:

Paul E. Black, "binary priority queue", in
*Dictionary of Algorithms and Data Structures* [online], Vreda Pieterse and Paul E. Black, eds. 16 November 2009. (accessed TODAY)
Available from: https://www.nist.gov/dads/HTML/binaryPriorityQueue.html