Build a Min-Heap — interactive algorithm visualization

Medium · Heap · time O(n log n) · space O(n)

Insert values one by one, sifting each up until the parent is smaller. The heap array is a complete binary tree.

Example input: values = [5,3,8,1,9,2]

Step through a verified execution trace - every step shows the real state, the invariant that keeps the algorithm correct, and asks you to predict what happens next.

Solve Build a Min-Heap in the editor · All 16 visualizations

Previous: Binary Tree Inorder · Next: Fibonacci (Recursion Tree)