Quick Sort

Quick Sort or partition-exchange sort is aptly named because, when properly implemented, it is the fastest known general-purpose in-memory sorting algorithm in the average case. Quick sort is a sorting algorithm developed by Tony Hoare that, on average, makes O(n log n) comparisons to sort n items.

In the worst case, it makes O(n2) comparisons, though this behavior is rare. Quick Sort is often faster in practice than other O(n log n) algorithms. It does not require the extra array. Quick Sort is widely used, and is typically the algorithm implemented in a library sort routine such as the UNIX qsort function.

Quick Sort is a divide and conquer algorithm. Quick Sort first divides a large array into two smaller sub-arrays: the low elements and the high elements. Quick Sort can then recursively sort the sub-arrays.

File Name:

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.