Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,23 @@
// version 1.1.51
import kotlin.concurrent.thread
fun sleepSort(list: List<Int>, interval: Long) {
print("Sorted : ")
for (i in list) {
thread {
Thread.sleep(i * interval)
print("$i ")
}
}
thread { // print a new line after displaying sorted list
Thread.sleep ((1 + list.max()!!) * interval)
println()
}
}
fun main(args: Array<String>) {
val list = args.map { it.toInt() }.filter { it >= 0 } // ignore negative integers
println("Unsorted: ${list.joinToString(" ")}")
sleepSort(list, 50)
}