Friday, June 17, 2011

Sleep sort - ingeniously funny!

For the last two days, the Amazon intern group has been flooded with emails about a new sorting algorithm some guy "invented". Nope, it is not the usual 'yet another sorting algorithm'. This one is ingenious in that it lets the handler of an element sleep for a time based on the value of that element. That way when they come back, all threads get in line and the values are sorted. The other funny part about this, apart from the concept, is that its coded in shell script (barely 10lines)!!

Check out the new addition to Wikipedia's infamous list of "humorous sorting" algorithms: sleep sort (or derp sort!) -

p.s: Turns out this is a mod of bogosort. Check out bogobogosort for a even bigger laugh!

No comments: