Re: Permutations Problem
- From: Christian Winter <thepoet_nospam@xxxxxxxx>
- Date: Wed, 31 May 2006 10:10:26 +0200
Honest John schrieb:
I am trying to filter every combination of ten letters through a spell
checker, and so find valid english words. I have a problem in that ten
factorial, is over three point-six million words to filter, and
results in the computer crashing. (The computer is an old 2.66GHz P4
and just not up to the task).
Any suggestions how I can save computer resources?
#--------%<--------%<-----------------------------------------------------------------------------
use Algorithm::Combinatorics qw(permutations);
Maybe using Math::Combinatorics instead could help. If I recall
correctly the permutations are calculated with each call to
next_permutation.
my $inp = Math::Combinatorics->new( [qw(s f e e r t v c o h)] );
while( my @permset = $inp->next_permutation )
{
my $searchword = join '', @permset;
push @words, $searchword if(
$speller->check( $searchword )
);
}
HTH
-Chris
.
- References:
- Permutations Problem
- From: Honest John
- Permutations Problem
- Prev by Date: Re: Date format conversion
- Next by Date: How do I run a Perl script as a Windows XP Service?
- Previous by thread: Permutations Problem
- Next by thread: How do I run a Perl script as a Windows XP Service?
- Index(es):
Relevant Pages
|
|