-
Permutations
What, do you guys think, is the best way to arrange 7 aribtrary letters in all of thier combinations and enter them into an array or compare them to an array.
i want to loop through each of these combinations, and then compare it to an array of 4000 elements to see if there are any matches
P.S. there are 8031810176 combinations
-
Thats gonna take a long time to loop through!! :D
-
well I was wondering if there was a faster way to do it than just looping through all of the possible combinations
-
You could do it a bit like the mastermind game, if it finds that a particular letter never occurs in a position then skip that part of the loop.
eg
(4000 matches)
DJEMLSJ
HSYEKDM
etc....
(7 aribtrary letters)
AKTNDO
(loop starts with A in position 1)
A******
if A does not occur in position 1 for any of the 4000 matches then skip looping though the combinations with A in position 1.
Hope that makes sense - it just an idea, ive probably miss-understood!
:)