Interactive Visualization
Watch heap sort work in real-time. The visualizer shows heap building and extraction.
Heap Sort Visualization
1x
What to Observe
As you watch the visualization, notice:
- Build heap: Array is converted to max heap
- Extract max: Root (maximum) is extracted
- Swap: Max is swapped with last element
- Heapify: Heap property is restored
- Repeat: Process continues until sorted
Understanding the Colors
- Orange/Yellow: Root (maximum element)
- Green: Elements in heap
- Blue: Elements being compared
- Red: Elements being swapped
- Purple: Sorted portion
Try Different Arrays
The visualizer shows how heap sort:
- Always builds a max heap first
- Extracts maximum elements systematically
- Maintains heap property throughout
- Guarantees O(n log n) performance
What’s Next?
Now that you’ve seen it work, let’s implement heap sort in code.
Progress 57%
Page 4 of 7
← Previous
→ Next