AlgoThrive
← All sorting algorithms

Quick Sort

PivotPartitioningPivot placedSorted

partition tree

pick a pivot, split, recurse

pseudocode

quickSort(lo, hi)
if lo >= hi return
pivot = a[hi]
partition: move smaller values left
place pivot at its final index p
quickSort(lo, p-1); quickSort(p+1, hi)

Frame 1 / 39

Start

unsorted array

4

3–16 integers between 1 and 20.