Timing n VS n*log(n).
Standard merge sort is , just playing around with some code I did some timing up to the size that all work sorting an array of integers fits in memory. When I drew the results initially I was convinced I had made a mistake, but this really was just b/c I had never quite realized how “linear”
looks at these sizes. Here is the graph (red dots are the measured time, blue is a line fitted with the next to last measured value, green is
fitted with the next to last measured value).
Note that I used to next to last value measured since the last value is a bit of an outlier (I was watching the system monitor, and for some reason the process switched to another core). All code is available in the github repository.

That’s pretty great and more convincing than my claim that, in reality, log is bounded by 50.
Anybody who thinks it’s worthwhile trying to remove a log term from an algorithm also probably thinks that spaghetti sort (http://en.wikipedia.org/wiki/Spaghetti_sort) is linear time. It’s not. Best I can figure, it’s $n^{3/2}$, significantly worse than merge sort.
Joe Miller
May 11, 2011 at 12:12 am
Spaghetti sort is a new one on me, the wikipedia analysis certainly leaves to be desired.
kasterma
May 11, 2011 at 10:01 am