in reply to Re: Permutation with repetitions
in thread Permutation with repetitions
Presumably, you don't want to count substrings that would be formed by the removal of the Xs?
Also, you mentioned earlier having all the permutations, including those with zero occurances, in the results hash. The problem with that is that by the time you get to n=13, you'd have 67 million entries in the hash, most of which would be 0.
Anyway, this might be of some use:
$s = 'aaaabccbaxxxcbddadcc';; ++$h{ $1 } while $s =~ m[(?=([abcd]{3})).]g;; pp \%h;; { aaa => 2, aab => 1, abc => 1, adc => 1, bcc => 1, bdd => 1, cba => 1, cbd => 1, ccb => 1, dad => 1, dcc => 1, dda => 1, }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Permutation with repetitions
by umeboshi (Acolyte) on Jun 08, 2010 at 13:16 UTC | |
|
Re^3: Permutation with repetitions
by space_agent (Acolyte) on Jun 12, 2010 at 20:32 UTC | |
by BrowserUk (Patriarch) on Jun 12, 2010 at 20:48 UTC |