Jump to content

Sorting algorithms/Sleep sort: Difference between revisions

no edit summary
No edit summary
Line 382:
Usage and output:
<lang javascript>[1, 9, 8, 7, 6, 5, 3, 4, 5, 2, 0].timeoutSort(function(n) { document.write(n + 'br'); })</lang>
<pre>
0
1
2
3
4
5
6
7
8
9
</pre>
 
=={{header|Mathematica}}==
<lang mathematica>SleepSort = RunScheduledTask[Print@#, {#, 1}] & /@ # &;
SleepSort@{1, 9, 8, 7, 6, 5, 3, 4, 5, 2, 0};</lang>
{{Out}}
<pre>
0
Cookies help us deliver our services. By using our services, you agree to our use of cookies.