Example #1
0
 private static void FindWordsInText(Trie trie, string[] randomSearchWords)
 {
     for (int i = 0; i < randomSearchWords.Length; i++)
     {
         Console.WriteLine("Word {0} appears {1}", randomSearchWords[i], trie.GetCount(randomSearchWords[i]));
     }
 }
Example #2
0
        private static Trie GenerateTrie(string[] words, int count)
        {
            var trie = new Trie();

            for (int i = 0; i < count; i++)
            {
                trie.AddWord(words[random.GenerateRandomNumber(0, words.Length - 1)]);
            }

            return trie;
        }