示例#1
0
        static void Main(string[] args)
        {
            var tree = new Tree();
            tree.Insert("romane");
            tree.Insert("romanus");
            tree.Insert("romulus");
            tree.Insert("rubens");
            tree.Insert("ruber");
            tree.Insert("rubicon");
            tree.Insert("rubicundus");

            Console.WriteLine("predecessor of the word \"romanes\":" + tree.FindPredecessor("romanes"));
            Console.WriteLine("successor of the word \"rom\":" + tree.FindSuccessor("rom"));

            Console.WriteLine(tree.Lookup("romulus") ? "there" : "not there");

            tree.Delete("romanus");
        }
示例#2
0
 public Trie(Tree t)
 {
     this.t = t;
 }