public void HasWordLookupBenchmark() { for (int i = 0; i < _words.Length; i++) { Assert.IsTrue(_trie.HasWord(_words[i])); } }
public static void FindWords(ITrie wordTrie) { for (int i = 0; i < 100; i++) { foreach (var word in SearchWords) { wordTrie.HasWord(word); } } }
public static int Fitness(List <char> individual, ITrie dictionary, string encryptedSentence) { int fitness = 1; string decryptedSentence = Encrypt(encryptedSentence, individual); string prefix = ""; foreach (var character in decryptedSentence) { prefix += character; if (dictionary.HasWord(prefix)) // prefix is a word in our dictionary { fitness += prefix.Length; } while (dictionary.GetWords(prefix).Count == 0) // no words with this prefix { prefix = prefix.Substring(1); // remove first character from prefix; } } return(fitness); }
public void HasWord01() { bool hasWord1 = trie.HasWord("test"); Assert.IsTrue(hasWord1); }