Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,11 @@
|
|||
val .countingSort = f(.array) {
|
||||
val .min, .max = minmax(.array)
|
||||
var .count = arr .max-.min+1, 0
|
||||
for .i in .array { .count[.i-.min+1] += 1 }
|
||||
for .i of .count { _for ~= arr .count[.i], .i+.min-1 }
|
||||
}
|
||||
|
||||
val .data = [7, 234, -234, 9, 43, 123, 14]
|
||||
|
||||
writeln "Original: ", .data
|
||||
writeln "Sorted : ", .countingSort(.data)
|
||||
Loading…
Add table
Add a link
Reference in a new issue