Quicksort

Computer Science

How It Works

Quicksort is an efficient, divide-and-conquer in-place array sorting algorithm. The algorithm isolates a pivot element and partitions adjacent values into dual sub-arrays according to whether they are smaller or greater than the pivot. Recursively repeating this partitioning protocol across divided sub-arrays achieves an optimal average-case runtime complexity of O(n log n) with negligible auxiliary memory overhead.

Governing Equation
T(n) = 2T(n / 2) + O(n) ⟹ T(n) = O(n log n) , T_{worst}(n) = O(n^2)