TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The fastest sorting algorithm? (2000)

14 pointsby pettouover 9 years ago

3 comments

chmikeover 9 years ago
Isn&#x27;t radix sort o(n) ?<p>&gt; The algorithm will only work if w ≥ log n.<p>What does that mean ? It doesn&#x27;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> &lt; log(n). I would add that it is only worth to use if <i>w</i> &lt;&lt; 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.
评论 #10870640 未加载
评论 #10871294 未加载
rurbanover 9 years ago
I wish nloglogn.c would come with an open source license. I&#x27;d really like to use it.
iofjover 9 years ago
There&#x27;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&#x27;s in is 1&#x2F;(n!). There is such a small likelihood of this that it&#x27;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&#x27;s safe to assume that it&#x27;s already optimally Sorted in some way that transcends our naïve mortal understanding of &quot;ascending order&quot;. 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:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Gematria" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;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&#x27;t sorted at this point. Twice. return x</code></pre>
评论 #10871228 未加载
评论 #10871203 未加载
评论 #10871225 未加载