[prev] 22 [next]

Randomised Quicksort

Quicksort applies divide and conquer to sorting:
  • Divide
    • pick a pivot element
    • move all elements smaller than the pivot to its left
    • move all elements greater than the pivot to its right
  • Conquer
    • sort the elements on the left
    • sort the elements on the right