Sleep sort

Not effective but it made me smile!

Sleep sort !

From the web:

In general, sleep sort works by starting a separate task for each item to be sorted, where each task sleeps for an interval corresponding to the item's sort key, then emits the item. Items are then collected sequentially in time.

Task: Write a program that implements sleep sort. Have it accept non-negative integers on the command line and print the integers in sorted order. If this is not idomatic in your language or environment, input and output may be done differently. Enhancements for optimization, generalization, practicality, robustness, and so on are not required.

Sleep sort was presented anonymously on 4chan and has been discussed on Hacker News.

Haha, that's hilarious!

You kind of cheat by making your input list a permutation of exactly all the integers [1,100]. I changed it to select 100 independently random numbers, and then your sort as written doesn't work:


You can see in the RESULT watcher on the stage that some nearby numbers aren't in order. Changing the delay from #1/100 to #1/10 fixes it, though, and ten seconds isn't so long to wait.

Where in Wikipedia did you find that? There's no article by that name.

Too bad it was anonymous; that inventor deserves some kind of prize, maybe an IgNobel.

Barrel sort!

done

I found a bug
image
more sense

Thk for your time!

Sry, it's from this link

look like Wikipedia a bit:


haha