Anagrams - Combinations/Perumatations

Blitz3D Forums/Blitz3D Beginners Area/Anagrams - Combinations/Perumatations


Simply parse the dictionary. If a word consists of characters that are all contained in the array then you can add them to the permutation list.You may also check the list for double entries. Did I miss something?



No, I think that's probably the most straightforward way of going about it. [EDIT: Removed rest - think I misread you. But anyway, yeah, I had gotten caught up on generating every possible permutation because, that way, if a 'proper' anagram exists for a word it will crop up somewhere along the permutation list... longwinded though as you'd still have to parse each permutation to discount the gobbledygook.]

Re coding the thing. I'd wrap each letter of the original string in a type with a 'used' field (set to false for each instance before each dictionary check begins) so you could easily remove letters from the equation once they had been matched and thus avoid problems associated with letter repetition.


*See Subirenihil's post.