Quick sort

Quick sort is also known as partition exchange sort. It was developed by Tony Hoare. Quick sort also utilizes the power of divide and conquer, which we came to understand in the previous section. It is just about dividing a problem into approximately similar sub problems, solving each sub problem separately, and combining the results of the sub problems to deliver the final result.

Quick sort steps can be laid out in following fashion:

  1. We select a pivot element. Selecting a proper pivot is very necessary for efficiency in a quick sort algorithm.
  2. We put the pivot element in such a location that all the elements on its left are less than the pivot element, and all the elements on its right are greater than the pivot. This way, we partition ...

Get Learning Functional Data Structures and Algorithms now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.