# Quicksort

Learn about quick-sort and partitioning algorithms.

## We'll cover the following

The quicksort algorithm is another classic divide-and-conquer algorithm. Unlike merge-sort, which does merging after solving the two subproblems, quicksort does all of its work upfront.

Quicksort is simple to describe: pick a random pivot element, `x`

, from
`a`

; partition `a`

into the set of elements less than `x`

, the set of elements equal to `x`

, and the set of elements greater than `x`

; and, finally, recursively sort the first and third sets in this partition.

## Visual demonstration

An example is shown in figure.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy