Quick Sort Animation & Pseudocode Walkthrough
Quick sort is a divide-and-conquer algorithm. It partitions the array around a pivot element so that values less than the pivot appear to its left and greater values to its right. The process repeats recursively on the left and right partitions until the list is sorted. Follow each pivot choice, comparison, and swap in this interactive visualizer while the pseudocode highlights the current step.
Pseudocode
- if low >= high: return
- set pivot ← array[high]
- set i ← low
- for j from low to high - 1:
- if array[j] ≤ pivot:
- swap array[i] and array[j]
- increment i
- swap array[i] and array[high]
- quickSort(low, i - 1)
- quickSort(i + 1, high)
Array Animation
pivot
comparing
swapping
active partition
sorted
Press Play or Step Forward to explore Quick Sort.