Data Update
This commit is contained in:
parent
015c2add84
commit
e50b5c3114
206 changed files with 6337 additions and 523 deletions
|
|
@ -0,0 +1,19 @@
|
|||
import kotlinx.coroutines.*
|
||||
|
||||
fun sleepSort(list: List<Int>, delta: Long) {
|
||||
runBlocking {
|
||||
list.onEach {
|
||||
launch {
|
||||
delay(it * delta)
|
||||
print("$it ")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val list = listOf(5, 7, 2, 4, 1, 8, 0, 3, 9, 6)
|
||||
println("Unsorted: ${list.joinToString(" ")}")
|
||||
print("Sorted : ")
|
||||
sleepSort(list, 10)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue