15 Jun, 2011, Zeno wrote in the 1st comment:
Votes: 0
#!/bin/bash
function f() {
sleep "$1"
echo "$1"
}
while [ -n "$1" ]
do
f "$1" &
shift
done
wait


Quote
./sleepsort.bash 5 3 6 3 6 3 1 4 7


I have no words.

Discussion: http://www.reddit.com/r/programming/comm...

Origin (lulz): http://dis.4chan.org/read/prog/129554415...
15 Jun, 2011, Barm wrote in the 2nd comment:
Votes: 0
My test has another six hundred years to go and then I will benchmark it against quicksort…
15 Jun, 2011, quixadhal wrote in the 3rd comment:
Votes: 0
Ooooo, it's linear time too!
15 Jun, 2011, David Haley wrote in the 4th comment:
Votes: 0
It's not actually really linear, at least not in the size of the input which is the normal way of measuring such things… compare the time it takes to sort "10 5 1" vs. "10000000000". I'm not sure how you'd even define such a thing: the algorithm time depends not on the size of the input, but the nature of the input. :wink:
15 Jun, 2011, Runter wrote in the 5th comment:
Votes: 0
Gross.
16 Jun, 2011, quixadhal wrote in the 6th comment:
Votes: 0
This came out of a DikuMUD codebase, didn't it? *wink*
16 Jun, 2011, Vigud wrote in the 7th comment:
Votes: 0
I hope not, because then it would be illegal to use *any possible* sorting algorithm in *any possible way*.
16 Jun, 2011, Tonitrus wrote in the 8th comment:
Votes: 0
Vigud said:
I hope not, because then it would be illegal to use *any possible* sorting algorithm in *any possible way*.

Don't worry, Diku uses Quantum Bogosort.
0.0/8