Quick-sort

Get to know about the quick-sort algorithm and how it uses recursion to sort elements.

Quick-sort algorithm and its partitioning technique

Quick-sort is another recursive sorting algorithm, discovered by Tony Hoare in 1959 and first published in 1961. In this algorithm, the hard work is splitting the array into smaller subarrays before recursion so that merging the sorted subarrays is trivial.

  1. Choose a pivot element from the array.
  2. Partition the array into three subarrays containing the elements smaller than the pivot, the pivot element itself, and the elements larger than the pivot.
  3. Recursively quick-sort the first and last subarrays.

Create a free account to access the full course.

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