Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -0,0 +1,34 @@
permute(a: ARRAY[INTEGER]; k: INTEGER)
require
ar_not_void: a.count>=1
k_valid_index: k>0
local
i,t: INTEGER
do
if k=a.count then
across a as ar loop io.put_string (ar.item.out) end
io.put_string ("%N")
else
from
i:= k
until
i> a.count
loop
t:= a[k]
a[k]:= a[i]
a[i]:= t
permute(a,k+1)
t:= a[k]
a[k]:= a[i]
a[i]:= t
i:= i+1
end
end
make
do
test:= << 2,5,1>>
permute(test, 1)
end
test: ARRAY[INTEGER]
end