September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,5 +1,7 @@
|
|||
use ntheory qw/forperm/;
|
||||
my @tasks = (qw/party sleep study/);
|
||||
forperm {
|
||||
print "@tasks[@_]\n";
|
||||
} scalar(@tasks);
|
||||
sub permutation {
|
||||
my ($perm,@set) = @_;
|
||||
print "$perm\n" || return unless (@set);
|
||||
permutation($perm.$set[$_],@set[0..$_-1],@set[$_+1..$#set]) foreach (0..$#set);
|
||||
}
|
||||
my @input = (qw/a b c d/);
|
||||
permutation('',@input);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
sub permutation {
|
||||
my ($perm,@set) = @_;
|
||||
print "$perm\n" || return unless (@set);
|
||||
permutation($perm.$set[$_],@set[0..$_-1],@set[$_+1..$#set]) foreach (0..$#set);
|
||||
}
|
||||
my @input = (qw/a 2 c 4/);
|
||||
permutation('',@input);
|
||||
use ntheory qw/forperm/;
|
||||
my @tasks = (qw/party sleep study/);
|
||||
forperm {
|
||||
print "@tasks[@_]\n";
|
||||
} @tasks;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue