As we may already by the name, quicksort is a very efficient method of sorting. However, there’s still some room for improvement to best avoid the worse case, such as a sorted array. The first solution we can use is to use a random privot instead of the start, mid or end position of the array. Further than that, we can use a hybrid sort rather than a pure recursive quicksort. The reason is that when we deal with a small array or data, sometimes it is faster to use an n^2 method than calling a function recursively.
Posted On March 11, 2020