# Heap

*noun*

say it: **“HEEP”** **/hiːp/**

A tree stored in an array that always keeps the most important item on top, ready to take next.

## What is a **heap**?

A **heap** keeps the most important item on top, ready to take, like an emergency room that always calls the most urgent patient. It's a complete binary tree stored in a plain array, and adding or removing the top takes O(log n). (Not the same as heap memory, where a program keeps its objects.)

## In a sentence

- “The waiting list is a **heap**, so the most urgent patient is always at the top.”

Level: Journeyman · [More Data Structures terms at this level](https://www.ask-codey.com/glossary?category=data-structures&level=3)

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/heap
