Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
5
Task/Permutations/Maple/permutations-1.maple
Normal file
5
Task/Permutations/Maple/permutations-1.maple
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
combinat:-permute(3);
|
||||
[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
|
||||
|
||||
combinat:-permute([a,b,c]);
|
||||
[[a, b, c], [a, c, b], [b, a, c], [b, c, a], [c, a, b], [c, b, a]]
|
||||
5
Task/Permutations/Maple/permutations-2.maple
Normal file
5
Task/Permutations/Maple/permutations-2.maple
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
fold:=(f,a,v)->`if`(nops(v)=0,a,fold(f,f(a,op(1,v)),[op(2...,v)])):
|
||||
insert:=(v,a,n)->`if`(n>nops(v),[op(v),a],subsop(n=(a,v[n]),v)):
|
||||
perm:=s->fold((a,b)->map(u->seq(insert(u,b,k+1),k=0..nops(u)),a),[[]],s):
|
||||
perm([$1..3]);
|
||||
[[3, 2, 1], [2, 3, 1], [2, 1, 3], [3, 1, 2], [1, 3, 2], [1, 2, 3]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue