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

  1. if low >= high: return
  2. set pivotarray[high]
  3. set ilow
  4. for j from low to high - 1:
  5.   if array[j]pivot:
  6.     swap array[i] and array[j]
  7.     increment i
  8. swap array[i] and array[high]
  9. quickSort(low, i - 1)
  10. quickSort(i + 1, high)

Array Animation

pivot comparing swapping active partition sorted
Press Play or Step Forward to explore Quick Sort.