Exemplo n.º 1
0
 static void Main(string[] args)
 {
     BST b = new BST();
     for (int i = 0; i < 10; i++) {
         b.Add(i);
     }
 }
Exemplo n.º 2
0
 static void Main(string[] args)
 {
     //create a tree
     //source: http://msdn.microsoft.com/en-us/library/aa289150(v=vs.71).aspx
     BST tree = new BST();
     //split a phrase by space characters
     List<string> words = new List<string>("buy a motorcycle and go fishing".Split(' '));
     words.Remove(String.Empty);
     //phrase is not alphabetized. insert into tree
     foreach (string word in words) {
         tree.Add(word);
     }
     try {
         RecursiveTest(tree, words);
         Console.WriteLine("Test succeeded");
     } catch (Exception) {
         Console.WriteLine("Test failed");
     }
 }