Binary Heap (Min-Heap) Playground

Heap = array + parent≤child rule. Insert → sift up; extract-min → sift down. Tree & array side by side, step by step. The priority queue engine. An…

Why it matters

Heaps sit behind Dijkstra, A*, task schedulers, heapsort, top-k and merging many sorted lists. Its tree has no pointers: positions are index arithmetic, 2i + 1, 2i + 2, (i − 1) >> 1, so every operation touches one path log n high.

The key idea

A heap is an array that keeps parent ≤ child

Common mistakes

Try it in this playground