Quicksort is a comparison sorting algorithm for elements of an array for which a total order is defined. When implemented well, it is significantly faster than merge sort or heap sort.
Although in worst-case scenarios the algorithm makes comparisons (when the range is already sorted), on average the complexity is only . Quicksort is a divide and conquer algorithm; it partitions (divides) a large range into smaller ones and sorts them recursively. There are several partitioning schemes. In the implementation shown here, we ...