Quicksort

Quicksort is an efficient O(n*log(n) method for sorting.

Also a classic example of divide-and-conquer problem solving.

Basic idea is as follows:

  1. choose an element x to be pivot

  2. rearrange sequence so that:

    • all elements less than pivot are at left

    • all elements greater than pivot are at right

  3. sort left part, sort right part (recursive)

Index