Step 1/0
Custom array:
Complexity
Best:O(n log n)
Average:O(n log n)
Worst:O(n²)
Space:O(log n)
Description
Selects a pivot element, partitions the array into elements less than and greater than the pivot, then recursively sorts each partition.
When to use
Average O(n log n) with small constant factor. Typically fastest in practice for in-memory sorting. Widely used in system libraries.