"Merge sort divides blindly down the middle. Quicksort divides cleverly around a pivot — and that cleverness makes it usually faster, but occasionally catastrophic. The whole story is in how you pick the pivot."
The Algorithm
Quicksort is the other great divide-and-conquer sort, but it does its work before the recursion instead of after. Pick a pivot element. Partition the array so everything smaller than the pivot goes left and everything larger goes right — now the pivot is in its final sorted position. Then recursively quicksort the left part and the right part. There's no merge step: once both sides are sorted, the whole thing already is. The clever work is the partition; the combine is free.
Why It's Usually the Fastest
Quicksort's killer feature is that it partitions in place — just swapping elements within the array, no O(n) temporary buffer like merge sort needs. That means less memory and, crucially, excellent cache locality (it works on a contiguous array, the cache advantage from the arrays lesson). In practice, on big random arrays, quicksort typically beats merge sort despite the same O(n log n) average, purely on those constant factors. It's the default in many language libraries' unstable-sort path for exactly this reason.
The Catch: Bad Pivots Cause O(n²)
Here's quicksort's dark side. If the pivot is consistently terrible — say you always pick the first element, and the array is already sorted — then each partition peels off just one element instead of splitting in half. That's n levels of recursion, each doing O(n) work: O(n²), the same as bubble sort, on what should be an easy input. The fix is pivot selection: pick a random pivot, or the median of three (first, middle, last). This makes the pathological case astronomically unlikely, restoring reliable O(n log n) in practice. (Quicksort is also not stable — equal elements may be reordered.)
The Bonus: Quickselect
The partition idea has a brilliant offshoot. To find the k-th smallest element without fully sorting, partition once: the pivot lands at some position p. If p == k, you're done; if k < p, recurse only into the left part; else only the right. Since you recurse into just one side, this quickselect runs in O(n) average — finding a median or 'top k by rank' without paying for a full O(n log n) sort. It's the partition step liberated from the obligation to sort everything.