Comment by Stormbringer
15 years ago
Sleepsort: For each item in a list of items, create a thread that sleeps as long as its number, then prints its number.
E.g. 5,3,2,1,10 makes five threads, one sleeps for one second and prints 1, one sleeps for two seconds and prints 2, one sleeps for three seconds and prints 3, one sleeps for five seconds and prints 5 and the last one sleeps for 10 seconds and prints 10.
No comments yet
Contribute on Hacker News ↗