Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,5 @@
|
|||
circle_sort =: post power_of_2_length@pre NB. the main sorting verb
|
||||
power_of_2_length =: even_length_iteration^:_ NB. repeat while the answer changes
|
||||
even_length_iteration =: (<./ (,&$: |.) >./)@(-:@# ({. ,: |.@}.) ])^:(1<#)
|
||||
pre =: , (-~ >.&.(2&^.))@# # >./ NB. extend data to next power of 2 length
|
||||
post =: ({.~ #)~ NB. remove the extra data
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
show =: [ smoutput
|
||||
|
||||
8 ([: circle_sort&.>@show ;&(?~)) 13 NB. sort lists length 8 and 13
|
||||
┌───────────────┬────────────────────────────┐
|
||||
│0 6 7 3 4 5 2 1│3 10 1 4 7 8 5 6 2 0 9 11 12│
|
||||
└───────────────┴────────────────────────────┘
|
||||
┌───────────────┬────────────────────────────┐
|
||||
│0 1 2 3 4 5 6 7│0 1 2 3 4 5 6 7 8 9 10 11 12│
|
||||
└───────────────┴────────────────────────────┘
|
||||
|
||||
8 ([: circle_sort&.>@show ;&(1 }. 2 # ?~)) 13 NB. data has repetition
|
||||
┌─────────────────────────────┬──────────────────────────────────────────────────────┐
|
||||
│2 3 3 5 5 1 1 7 7 6 6 4 4 0 0│12 11 11 4 4 3 3 9 9 7 7 10 10 6 6 2 2 1 1 5 5 8 8 0 0│
|
||||
└─────────────────────────────┴──────────────────────────────────────────────────────┘
|
||||
┌─────────────────────────────┬──────────────────────────────────────────────────────┐
|
||||
│0 0 1 1 2 3 3 4 4 5 5 6 6 7 7│0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12│
|
||||
└─────────────────────────────┴──────────────────────────────────────────────────────┘
|
||||
Loading…
Add table
Add a link
Reference in a new issue