Heap (data structure)

Example of a binary max-heap containing items between 1 and 100.

In computer science, a heap is a type of tree (data structure) that satisfies the heap property. Heaps are useful when you need to remove the item with the highest (or lowest) value. A common implementation of a heap is the binary heap in which the tree is a complete binary tree.

Heap property

Operations

Maintaining the heap property