[英]How can I create a combination/permutation of words in a trie from a character array?
I have a trie that contains multiple words in it.我有一个包含多个单词的 trie。 I am attempting to create a permutation/combination of all possible words that can be found in the dictionary from an array of characters without repeats of letters in the char array.我正在尝试从字符数组中创建可以在字典中找到的所有可能单词的排列/组合,而字符数组中没有重复的字母。 I have tried to research ideas/starting point but all the possible solutions I have found are allowing repeats, which is not what I want.我试图研究想法/起点,但我发现的所有可能的解决方案都允许重复,这不是我想要的。
For example:例如:
Suppose I have the words {tiptoe, top, tuple, put, pups, pop, putt } in the trie and I have the char array that contains: [t, i, p, u, l, o, e, s].假设我在 trie 中有单词 {tiptoe, top, tuple, put, pups, pop, putt },并且我有一个包含 [t, i, p, u, l, o, e, s] 的 char 数组。
The output should be: output 应该是:
Can someone please help me out with starting this algorithm?有人可以帮我启动这个算法吗?
Example first iteration:第一次迭代示例:
char from char array = t;
chars marked in word array : {t`iptoe, t`op, t`uple, put`, pups, pop, put`t }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.