Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,25 @@
|
|||
F flatten(some_list)
|
||||
[Int] new_list
|
||||
L(sub_list) some_list
|
||||
new_list [+]= sub_list
|
||||
R new_list
|
||||
|
||||
F radix_sort(l, =p = -1, =s = -1)
|
||||
I s == -1
|
||||
s = String(max(l)).len
|
||||
I p == -1
|
||||
p = s
|
||||
|
||||
V i = s - p
|
||||
I i >= s
|
||||
R l
|
||||
|
||||
V bins = [[Int]()] * 10
|
||||
|
||||
L(e) l
|
||||
bins[Int(String(e).zfill(s)[i])] [+]= e
|
||||
|
||||
R flatten(bins.map(b -> radix_sort(b, @p - 1, @s)))
|
||||
|
||||
V arr = [7, 6, 5, 9, 8, 4, 3, 1, 2, 0]
|
||||
print(radix_sort(arr))
|
||||
Loading…
Add table
Add a link
Reference in a new issue