Пример #1
0
        public void TrieDeleteTest()
        {
            var trie = new WordTrie();

            trie.Insert("ab");
            trie.Insert("abc");
            trie.Insert("abd");

            trie.Delete("ab");
            Assert.False(trie.Search("ab"));
            Assert.True(trie.Search("abc"));
            Assert.True(trie.Search("abd"));

            trie.Delete("abc");
            Assert.False(trie.Search("ab"));
            Assert.False(trie.Search("abc"));
            Assert.True(trie.Search("abd"));

            trie.Delete("abd");
            Assert.False(trie.Search("ab"));
            Assert.False(trie.Search("abc"));
            Assert.False(trie.Search("abd"));
        }