Quick sort

Quick sort · O(n log n)

Elements Active CompletePlayed 0.0 s · same input

Quick sort

Quick sort
O(n log n)
Operations0
Comparisons0
Writes0

Each comparison or write counts as 1 operation. Playback time is not execution time.

← Back to six-algorithm comparison
How it works +

Uses the last element as pivot, moves smaller values left and processes both sides recursively. Average time is O(n log n), worst case O(n²); worst-case recursion space is O(n).

Extra space: O(log n) on average; Unstable. Each comparison or main-array write counts as 1 operation.