Skip to content

Glossary: Data Structures and Algorithms in JavaScript

Heap

Also written: heaps, min-heap, MinHeap

A binary tree stored in a plain array where every parent comes out no later than its children, so in a min-heap the smallest item is at index 0. Push and pop are O(log n), and it is not stable.

Where the book teaches it

Related terms

Priority queueMax-heapSift up, sift down