i'm doing a game project,in which we have to form words dynamically with the given set of letters... the given set of letters may contain duplicate also.. while forming words we can use a letter from a given set of letters for any number of times(say for twice or thrice)... help me with an algorithm to form all possible meaningful words from the given set
Thank u all
The simple approach is to create every possible ordering of letters, then compare each one of them to your dictionary.
You can refine it a bit by storing the dictionary in a data structure which facilitates quick lookups. (hash table, tree, etc) I've been meaning to implement a 28-ary tree for quick dictionary word access, but haven't got around to it yet.