made by Abhirai
O(patience)
Seehowsortingactually works.
Step through the inner loop of five classic algorithms. Watch every compare, swap and write — with live complexity and stats.
Algorithm Visualizer
210
251
902
213
394
465
596
597
138
959
9010
2911
4312
5113
2014
5115
4316
817
7118
9519
idlePress Play to begin
step 00 total
Legend:unsortedcomparingpivotsorted
⚠ Duplicate valuesEqual-height bars can make compares/swaps look like no-ops — affects stable-vs-unstable demos.
⚙️ Parameters
▶︎ Playback & tools
🔢 Custom array— comma or space separated, 1–100, up to 100 numbers
📖 Step history
showing last 0 of 0
No steps yet — press Play.
Comparisons
0
Swaps
0
Array writes
0
Quick Sort
Picks a pivot, partitions elements into less-than / greater-than groups, then recurses. Fast in practice and cache-friendly.
Stable: NoSpace O(log n)
Real-world use
- ›General-purpose in-memory sort
- ›Language standard libraries (with introsort fallback)
Complexity
Best
O(n log n)
Average
O(n log n)
Worst
O(n²)
Space
O(log n)
Keyboard
Space — play/pause · ←/→ — step · R — reset
Pseudocode — Quick Sort
idle1quickSort(a, low, high):2 if low >= high: return3 p = partition(a, low, high)4 quickSort(a, low, p-1)5 quickSort(a, p+1, high)67partition(a, low, high):8 pivot = a[high]; i = low9 for j from low to high-1:10 if a[j] < pivot: swap(a[i], a[j]); i++11 swap(a[i], a[high])12 return i
0/0
🏁 Race all algorithms
Same input, every algorithm — watch them sort side by side.
Pick a size and pattern, then hit Load race.