code

A heap is a tree data structure where each node's data is greater than any of its children. Heaps are commonly used as priority queues.

Operations

Common operations on a heap include:

Heap sort

A heap sort is carried out by inserting all the items from a list into a heap. The sorted list can then be created by taking the root node and appending it into a list until the heap is empty.

Variants

See also

External links