SleepSort from 4Chan
Contents
4Chan isn’t exactly what you’d associate with ‘shit, that’s a cool piece of code!’, but look what I found!
(via HN)
Nice hack. And it is O(N)
in bitsize of largest number (Ignoring all the overhead of forking new processes, the problem with the race conditions(Sort 0 and 0.1? How about 0.01 and 0.011?), processor contention, etc,.) They basically delegated the sorting to the process scheduler, treating it as a sort of priority queue.
Sometimes you just see a hack so out of the box that it makes you say ‘woah!’ and let your mouth hang open there for a while. One such time this :)
Author yuvipanda
LastMod 2011-06-19