in reply to counting instances of one array in another array
The answer why your solution is so slow: the number of permutations is exponential. You'll be spending the majority of your time initializing the @permCounts array, and most of its elements will remain 0.my @observed = ("ab", "ab", "ad", "an", "bd", "bn", "dn"); my %permCounts; $permCounts{$_}++ for @observed;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: counting instances of one array in another array
by jsmagnuson (Acolyte) on Feb 23, 2012 at 12:24 UTC | |
by JavaFan (Canon) on Feb 23, 2012 at 13:22 UTC | |
by jandrew (Chaplain) on Feb 23, 2012 at 17:07 UTC | |
by jandrew (Chaplain) on Feb 23, 2012 at 17:52 UTC | |
by Anonymous Monk on Feb 23, 2012 at 14:42 UTC | |
by JavaFan (Canon) on Feb 23, 2012 at 14:50 UTC |