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.
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.