Overview
Quick Sort chooses a pivot, rearranges the array so smaller values are on one side and larger values are on the other, then recursively sorts the partitions.
Sorts a list by partitioning values around a pivot and recursively sorting each side.
Compact metadata for implementation and discovery.
Quick Sort chooses a pivot, rearranges the array so smaller values are on one side and larger values are on the other, then recursively sorts the partitions.
Quick facts
Runtime and memory behavior at a glance.
Best
O(n log n)
Average
O(n log n)
Worst
O(n^2)
Space
O(log n)
Show a pivot and values moving to the correct side of it.
Quick sort is usually fast in memory, but its worst case is avoided through pivot strategy and implementation safeguards.
What each reference supports for this entry.
Textbook support for Quick Sort invariants, recurrences, relaxation rules, or asymptotic analysis.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.
Sorting · Foundation
Heap Sort avoids Quick Sort's worst-case partition behavior but is usually less cache-friendly.
Compare with thisSorting · Foundation
Quick Sort partitions in place, while Merge Sort merges sorted subarrays.
Compare with thisQuick Sort partitions in place, while Merge Sort merges sorted subarrays.
Quickselect adapts Quick Sort partitioning to select one order statistic.