Quick Sort Algorithm

The quick sort algorithm is a divide-and-conquer algorithm that can be implemented using a recursive function. The following graphic explains the different steps of a quick sort algorithm.

Note, that the quick sort algorithm starts by identifying a pivot. Depending on the implementation, this pivot can be one of the following three values:

  • The first value of the list of values to be sorted,
  • The mid-value of the list,
  • The last value of the list.

The example below uses the mid-value of the list (value in the middle position):
Quick-Sort-Algorithm

Python Code

Here is our Python implementation of a quick sort algorithm using a recursive function. This implementation uses the mid-value as the pivot.

Did you like this challenge?

Click on a star to rate it!

Average rating 4.2 / 5. Vote count: 49

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: