Watch quicksort partition bars around a pivot — small left, big right. Average O(n log n) and usually fastest, but watch the reversed array degrade to O(n²).
Algorithm
Array
Comparisons
0
Swaps/writes
0
Step
0/467
Reads
0
Aux memory
0
Call depth
1/1
Slow the speed and use Step to match the pseudocode highlight with the bar colors.
Pseudocode
quickSort(lo, hi)
pivot ← a[hi]
for j ← lo to hi−1
if a[j] ≤ pivot: a[i++] ↔ a[j]
a[i] ↔ a[hi] // 피벗 확정
quickSort(lo,i−1) quickSort(i+1,hi)
Time complexity
| Best | O(n log n) |
|---|---|
| Average | O(n log n) |
| Worst | O(n²) |
| Space | O(log n) |
| Stable | No |
Quicksort picks a pivot (purple bar), partitions the array so smaller values go left and larger go right, then recurses on each side. The pivot's final position locks in after each partition.
Balanced pivots give log n depth → average O(n log n) with excellent cache locality, which is why most built-in sorts are quicksort-based. But an always-worst pivot (e.g. last element on a reversed array) degrades to O(n²) — try the Reversed preset to see it happen. Sorting Visualizer