What is a Heap Visualizer?
A heap visualizer is an interactive tool that turns array input into a binary heap diagram. It is useful for understanding priority queues, heap sort, heapify, insert, and extract operations.
This tool supports both min heap and max heap mode. In a min heap, every parent is smaller than or equal to its children. In a max heap, every parent is larger than or equal to its children.
For the focused pattern library, browse the Algorithm Visualizers hub.
How to use this heap visualizer
- Paste an array such as
[42, 18, 33, 9, 21, 27, 60]. - Choose Min heap or Max heap.
- Click Build heap to heapify the array.
- Insert a new value or extract the root to see how the heap changes.
- Compare the tree diagram with the level-order array representation.
Binary heaps are usually stored as arrays. For a node at index i, the left child is at 2i + 1 and the right child is at 2i + 2.
A worked example you can share
Follow min heap heapify with every swap to build [9, 4, 7, 1, 3, 6, 2] and extract its minimum.
Copy example link preserves the current diagram values, mode and highlights. Opening the link restores those values, without operation history or unbuilt input. Anyone with the link can see the values. Download SVG exports a sharp diagram with node indexes for lesson notes or slides.
Heap vs binary search tree
A heap is optimized for quickly finding the minimum or maximum value. It does not keep values fully sorted.
A binary search tree keeps smaller values on the left and larger values on the right. If you need search-tree ordering, use the Binary Search Tree Visualizer.
If you want to compare heap extraction with step-by-step ordering, try the Sorting Algorithm Visualizer.