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.
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.