Exemplo n.º 1
0
        static void Main(string[] _)
        {
            BST <int, int> tree = new BST <int, int>();

            foreach (var item in Enumerable.Range(1, 10))
            {
                tree.Insert(item);
            }
            Console.Write(tree.Find(5));
            Console.Read();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            BinaryTree bt  = new BinaryTree();
            BST        the = new BST();

            int[] e = new int[] { 2, 1, 2, 3, 5, 4, 6, 7 };
            foreach (int i in e)
            {
                bt.Insert(i);
                the.Insert(i);
            }
            Console.WriteLine("Inoreder Traversal : ");
            the.Inorder(the.GetRoot);
            Console.WriteLine(" ");
            Console.WriteLine();
            // Node least = the.LCA(the.GetRoot, 8, 25);
            //Console.WriteLine(bt.checkBST(the.GetRoot));
            Console.WriteLine(bt.checkBST(bt.GetRoot));
            Console.WriteLine();
            Console.ReadKey();
        }