Heap Sort Visualizer — Animated, Step-by-Step
Animated heap sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs in your browser.
Code examples
Ready-to-copy reference implementations. Free to use in your own projects and assignments.
How to use
- 1 Press Play to watch the array build a max-heap, then repeatedly extract the max.
- 2 Use Step to advance one sift-down comparison at a time.
- 3 Type your own numbers into Custom input and press Apply.
- 4 Follow the highlighted pseudocode and the live comparison / swap counters.
Why use this tool
- See how the array is treated as a binary heap (parent at i, children at 2i+1 / 2i+2).
- Watch sift-down restore the heap property after each max is moved to the end.
- Understand why heap sort guarantees O(n log n) with O(1) extra space.
- Runs entirely in your browser. No signup, no uploads.
Frequently asked questions
What is heap sort?
Heap sort builds a max-heap from the array, then repeatedly swaps the root (largest) to the end and sifts down to restore the heap, growing a sorted region from the right.
What is the time complexity of heap sort?
O(n log n) in the best, average, and worst case. Building the heap is O(n) and each of the n extractions costs O(log n).
Is heap sort stable?
No. Heap operations swap elements far apart, which can reorder equal values.
How does heap sort compare to quicksort?
Heap sort has a guaranteed O(n log n) worst case and uses O(1) extra space, but quicksort is usually faster in practice due to better cache locality and a smaller constant factor.
What is Heap Sort Visualizer?
A Heap Sort Visualizer animates heap sort: building a max-heap from the array, then repeatedly swapping the root to the end and sifting down to restore the heap. It demonstrates the guaranteed O(n log n) time with O(1) extra space.
Heap Sort Visualizer is a free algorithm utility by Zerethon Tools. Animated heap sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs in your browser. Runs entirely in the browser — no signup, no upload.
- Category
- Algorithm
- Pricing
- Free
- Privacy
- Browser-based
- Signup
- Not required
Privacy
Your data never leaves your browser unless explicitly stated. Heap Sort Visualizer runs entirely client-side — no server upload, no logging, no tracking of your input.
Related tools
Bubble Sort Visualizer
Animated bubble sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs entirely in your browser.
Open toolInsertion Sort Visualizer
Animated insertion sort with step controls, speed, custom input, live comparison/write counters and pseudocode. Runs in your browser.
Open toolSelection Sort Visualizer
Animated selection sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs in your browser.
Open toolMerge Sort Visualizer
Animated merge sort with step controls, speed, custom input, live comparison/write counters and pseudocode. Runs in your browser.
Open toolBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.