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
idlePress Play to begin
step 00 total
Legend:unsortedcomparingpivotsorted
⚙️ 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.