Lets say you have an array of size n with randomly generated elements and you want to use quicksort to sort the array. For large enough n (say 1,000,000), in order to speed up quicksort, it would make sense to stop recursing when the array gets small enough, and use insertion sort instead. In such an implementation, the base case for Quicksort is some value base > 1. What would the optimal base value to choose and why?
Lets say you have an array of size n with randomly generated elements and
Share
Think about the time complexity of quicksort (average and worst case) and the time complexity of other sort that might do better for small n.