Homework 5 Sorting

02/15/2014 11:47

This is a graph showing the running times of various sorting algorithms at 10, 100, and 1000 integer elements each. At 10000 elements, most everything has stack overflow from insufficient memory storage because of the recursive algorithms. Those that did complete took hundreds of seconds. In short, quicksort was the best for low numbers, but quickly becomes the worst for large numbers. Also, the best pivot is the median of three, which seemed obvious to me from the start. You can also do median of 5, which will make it better for larger numbers, but since you wouldn't want to use this algorithm on large numbers anyway I don't think that actually is helpful. On the surface, they all look somewhere around O(N2) but closer examination and analysis shows ONLogN for most all of them. And InsertionSort has the possibility for both the best runningtime in a best case scenario for large numbers, and the worst runningtime in a worst case scenario for large numbers. BubbleSort would be my least recommended for anything. Only value is that it is quick to setup.