Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
19
Task/Permutations/Liberty-BASIC/permutations-2.basic
Normal file
19
Task/Permutations/Liberty-BASIC/permutations-2.basic
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
n = 3
|
||||
|
||||
s$=""
|
||||
for i = 1 to n
|
||||
s$=s$;i
|
||||
next
|
||||
|
||||
res$=permutation$("", s$)
|
||||
|
||||
Function permutation$(pre$, post$)
|
||||
lgth = Len(post$)
|
||||
If lgth < 2 Then
|
||||
print pre$;post$
|
||||
Else
|
||||
For i = 1 To lgth
|
||||
tmp$=permutation$(pre$+Mid$(post$,i,1),Left$(post$,i-1)+Right$(post$,lgth-i))
|
||||
Next i
|
||||
End If
|
||||
End Function
|
||||
Loading…
Add table
Add a link
Reference in a new issue