in reply to counting instances of one array in another array
Good grief, people ... you don't even need a hash. You almost don't need a program.
SELECT PERM, COUNT(*) FROM PERMUTATIONS GROUP BY PERM;
If you need to know the position of a permutation then you can calculate it. The position of ABC = (1,2,3) = 1 + 2*26^2 + 3*26^3, good enuf.
If you then need to generate that huge matrix then ... generate it, as an output, using a nested loop, filling in the minuscule fraction of those entries that are not zero.
You never have to store the entire range of possibilities; you need to store or count what you've actually got.
In the following post, and within ten minutes flat, BrowserUK will now proceed to demonstrate why this reasoning is totally and utterly wrong and why my brain must be disconnected for saying it ...
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: counting instances of one array in another array
by LanX (Saint) on Feb 23, 2012 at 18:13 UTC | |
|
Re^2: counting instances of one array in another array
by jsmagnuson (Acolyte) on Feb 24, 2012 at 11:07 UTC | |
by MidLifeXis (Monsignor) on Feb 24, 2012 at 13:53 UTC |