Quick Sort

Quick Sort :

In this sorting algorithm, array is partitioned into two non empty  sub parts such that every element in left part are less than or equal to every element on right side, then quick sort algorithm is recursively called for both the two parts.

Worst Case : O(n2)

Average Case : O(n log n)

Best Case : O(n log n)


    • Pick an element, called a pivot, from the array.
    • Reorder the array so that all elements with values less than the pivot come before the pivot, while all elements with values greater than the pivot come after it (equal values can go either way). After this partitioning, the pivot is in its final position. This is called the partition operation.
    • Recursively apply the above steps to the sub-array of elements with smaller values and separately to the sub-array of elements with greater values.



Leave a Reply

Your email address will not be published. Required fields are marked *