Re: Permutations Problem
- From: "Jürgen Exner" <jurgenex@xxxxxxxxxxx>
- Date: Fri, 02 Jun 2006 02:57:50 GMT
Honest John wrote:
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?
my @words = grep $speller->check ( join '', @$_ ),
permutations(\@data);
Quite simple, actually. Your algorithm first generates the whole set of
permutations, then filters the desired results.
Instead just check each candidate as you create it. This way you avoid
having to store the whole 10 factorial elements.
jue
.
- Prev by Date: Re: perldocs (etc) on recursion in Perl? Don't understand _WCPS_ example
- Next by Date: nested quantifier or unrecognized escape error
- Previous by thread: Re: Permutations Problem
- Next by thread: use Win32::TieRegistry if ($^O =~ /win32/i)
- Index(es):
Relevant Pages
|