Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
21
Task/Move-to-front-algorithm/J/move-to-front-algorithm-1.j
Normal file
21
Task/Move-to-front-algorithm/J/move-to-front-algorithm-1.j
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
spindizzy=:3 :0
|
||||
'seq table'=. y
|
||||
ndx=.$0
|
||||
orig=. table
|
||||
for_sym. seq do.
|
||||
ndx=.ndx,table i.sym
|
||||
table=. sym,table-.sym
|
||||
end.
|
||||
ndx
|
||||
assert. seq-:yzzidnips ndx;orig
|
||||
)
|
||||
|
||||
yzzidnips=:3 :0
|
||||
'ndx table'=. y
|
||||
seq=.''
|
||||
for_n. ndx do.
|
||||
seq=.seq,sym=. n{table
|
||||
table=. sym,table-.sym
|
||||
end.
|
||||
seq
|
||||
)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
spindizzy 'broood';'abcdefghijklmnopqrstuvwxyz'
|
||||
1 17 15 0 0 5
|
||||
spindizzy 'bananaaa';'abcdefghijklmnopqrstuvwxyz'
|
||||
1 1 13 1 1 1 0 0
|
||||
spindizzy 'hiphophiphop';'abcdefghijklmnopqrstuvwxyz'
|
||||
7 8 15 2 15 2 2 3 2 2 3 2
|
||||
Loading…
Add table
Add a link
Reference in a new issue