Definition:

  • It works by selecting a ‘pivot’ element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot.
  • The sub-arrays are then sorted recursively.

Ways to select a pivot:

  • First element
  • Last element
  • Median-of-three elements
  • Random element