Lets say you have an array of size 1,000,000 with randomly generated elements and you want to use quicksort to sort the array. 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?
A:
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.
Ken Struys
2010-10-08 01:50:50