Isn't radix sort o(n) ?<p>> The algorithm will only work if w ≥ log n.<p>What does that mean ? It doesn't make sense to me. The algorithm will <i>work</i> regardless of the magnitude of <i>w</i> relative to log(n).<p>Radix sort will be faster than n log(n) if <i>w</i> < log(n). I would add that it is only worth to use if <i>w</i> << log(n). In fact radix sort process the sorting by groups of bits, so <i>w</i> is usually smaller than the number of bits.
There's faster sorting algorithms:<p>1) ZEN sort: O(0)<p>a) It is build on the realisation that it is all about numbers that do not really mean anything.<p>b) It converges to NOTHINGNESS.. while it deletes all data there is.<p>2) Intelligent design sort (also known as miracle sort) O(1)<p>The probability of the original input list being in the exact order it's in is 1/(n!). There is such a small likelihood of this that it's clearly absurd to say that this happened by chance, so it must have been consciously put in that order by an intelligent Sorter. Therefore it's safe to assume that it's already optimally Sorted in some way that transcends our naïve mortal understanding of "ascending order". Any attempt to change that order to conform to our own preconceptions would actually make it less sorted.<p>3) Numerology Sort: O(n)<p>a) Employ gematria to calculate a divine hash sum of all the elements of the array, taking O(n) time. The specific method depends on the data type, and is left as an exercise to the reader.<p>b) Use this value to seed your PRNG.<p>c) Using the PRNG, sample pairs of indices and swap the indicated elements. Do this 4n times.<p>d) If the array is not sorted at this point, you have likely made an error in computing your hash. A debugging message is numerologically embedded in the output array that will guide you.<p>(Gematria: <a href="https://en.wikipedia.org/wiki/Gematria" rel="nofollow">https://en.wikipedia.org/wiki/Gematria</a> )<p>4) Sleep sort: O(largest number to be sorted)<p>a) read a number to be sorted, call it n<p>b) start a new thread, that sleep n seconds<p>c) insert the number in the result array<p>5) Chuck Norris sort<p>Chuck Norris once wrote by far the fastest sort algorithm ever. In Python:<p><pre><code> def sort(x):
# I will roundhouse kick any array that isn't sorted at this point. Twice.
return x</code></pre>