Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Permutations/Yabasic/permutations.basic
Normal file
27
Task/Permutations/Yabasic/permutations.basic
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
n = 4
|
||||
dim a(n), c(n)
|
||||
|
||||
for j = 1 to n : a(j) = j : next j
|
||||
|
||||
repeat
|
||||
for i = 1 to n: print a(i);: next: print
|
||||
i = n
|
||||
repeat
|
||||
i = i - 1
|
||||
until (i = 0) or (a(i) < a(i+1))
|
||||
j = i + 1
|
||||
k = n
|
||||
while j < k
|
||||
tmp = a(j) : a(j) = a(k) : a(k) = tmp
|
||||
j = j + 1
|
||||
k = k - 1
|
||||
wend
|
||||
if i > 0 then
|
||||
j = i + 1
|
||||
while a(j) < a(i)
|
||||
j = j + 1
|
||||
wend
|
||||
tmp = a(j) : a(j) = a(i) : a(i) = tmp
|
||||
endif
|
||||
until i = 0
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue