Sorting Algorithm Visualizer
Watch bubble, insertion, selection, merge, and quick sort run step-by-step on adjustable arrays with comparison/swap counters and speed control.
Loading tool...
What is Sorting Algorithm Visualizer?
The Sorting Algorithm Visualizer animates five classic sorts - bubble, insertion, selection, merge, and quick - on a random array of adjustable size. Every compare and swap is pre-computed and played back with color highlighting, live counters, and adjustable speed so you can watch O(n squared) and O(n log n) behavior unfold.
Key Benefits
- See the mechanics behind every textbook sort
- Compare operation counts across algorithms on the same array
- Slow playback makes tricky partition and merge steps clear
- Great for study, interview prep, and classroom demos
- No installs - everything runs in your browser
Common Use Cases
- •Studying for CS exams or coding interviews
- •Teaching algorithm basics with a live visual
- •Comparing bubble, merge, and quick sort costs
- •Demonstrating why algorithm choice matters at scale
- •Exploring how sorted arrays emerge step-by-step
How to Visualize a Sorting Algorithm
- Pick an algorithm: Choose bubble, insertion, selection, merge, or quick sort from the dropdown.
- Set array and speed: Adjust the array size and playback speed - smaller arrays and lower speeds show details best.
- Run the visualization: Click Visualize to generate the random array and play every compare and swap step.
- Compare the counters: Read the final comparison and swap totals, then switch algorithms to feel the efficiency difference.
Key Features
- Five algorithms: bubble, insertion, selection, merge, quick
- Random arrays from 10 to 60 elements
- Step-by-step playback with pause, resume, and speed control
- Color-coded compare (amber) and swap (red) highlighting
- Live comparison and swap counters
- Fully client-side with pre-computed deterministic steps