Sort Target
Algorithm
Speed
Normal ~12s · 158 ms/step
Quicksort(1959)
▶ Try this Source
O(n log n) ✗ Stable ✓ In-place
🔧 How it works

Selects a pivot element, partitions the array in-place into elements ≤ pivot on the left and elements > pivot on the right, then recursively sorts each side.

🎯 Key property

O(n log n) average but O(n²) worst-case when the pivot is consistently the smallest or largest element, the simplest demonstration of why pivot selection is critical.

👁 Watch for
  • Compare each element in the unsorted region is tested against the pivot to determine which side it belongs to
  • Swap elements found on the wrong side of the partition boundary are swapped across it; the pivot is placed at its final sorted position at the end
  • End of partition the pivot's position is fixed, splitting the remaining unsorted work into two independent sub-problems
Initial State
This is the array before sorting. Follow Quicksort step by step.
Recursion Tree
[0..9)371952846
0 / 76 ops ( 0.0%) 0.0%
Sorting is
a spectacle.
Algorithms at work, in a daily vertical feed. Watch, play, challenge — and go deeper when you're ready.
Loading 0%
An unhandled error has occurred. Reload 🗙