Quick Sort
Picks a pivot, partitions elements around it, then recursively sorts each partition.
0 elements
>Ready — Quick Sort
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Analysis
BEST O(n log n)
AVG O(n log n)
WORST O(n²)
SPACE O(log n)
Quick Sort picks a pivot and partitions the array so smaller elements go left, larger go right. It recursively sorts both sides. Pivot choice matters — bad pivots cause O(n²), but average case is among the fastest.