Sorting algorithms/Sleep sort: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 382: | Line 382: | ||
Usage and output: |
Usage and output: |
||
<lang javascript>[1, 9, 8, 7, 6, 5, 3, 4, 5, 2, 0].timeoutSort(function(n) { document.write(n + 'br'); })</lang> |
<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> |
<pre> |
||
0 |
0 |