← Back to All Algorithms
🎲 Randomized Quicksort
Why Randomize?
Problem: Standard Quicksort is O(n²) on sorted input (always picks worst pivot).
Solution: Pick a random pivot! This gives expected O(n
log n) regardless of input order.
Click "Start" — uses randomly chosen pivot each partition!
Sorted Input + Fixed Pivot
O(n²) worst case
Any Input + Random Pivot
Expected O(n log n)