Quick Sort

Quick sort is the highly effective sorting algorithm which is based on the partitioning of arrays. In quick sort, a pivot element is selected. This point can be an element of the array, the first, the last or any. Based on this the array is divided into three parts: Elements less than the pivot, the pivot itself and the elements greater than the pivot.

Example: Let the array be, S= {32,34,41,9,13,18,26,43,25,30}

Now, let's take the last element 30 as the Pivot point. After the first pass, the arrangement will be:

S = {32,34,41,9,13,18,26,43,25,30}. The array is set with the pivot point at its position and all the elements smaller and greater than the pivot point on its either sides. Now the two sides of the pivot are considered as sub-arrays and the same recursive operation is applied on these arrays till we get the sorted array.


This clip will help you understand the working of Quick sort better.

quick sort example