Sorting algorithms/Sleep sort: Difference between revisions

Content added Content deleted
(→‎{{header|F#}}: Corrected header as suggested on the Count examples/Full list/Tier 4 talk page)
(Implementation for Visual Basic .NET added)
Line 2,137: Line 2,137:
5
5
9
9
</pre>

=={{header|Visual Basic .NET}}==
<lang vbnet>Imports System.Threading

Module Module1

Sub SleepSort(items As IEnumerable(Of Integer))
For Each item In items
Task.Factory.StartNew(Sub()
Thread.Sleep(1000 * item)
Console.WriteLine(item)
End Sub)
Next
End Sub

Sub Main()
SleepSort({1, 5, 2, 1, 8, 10, 3})
Console.ReadKey()
End Sub

End Module</lang>

{{out}}
<pre>
1
1
2
3
5
8
10
</pre>
</pre>