Esempio n. 1
0
        public static void Main(string[] args)
        {
            BinaryTree tree = new BinaryTree();

            /* Assume that inorder traversal
             * of following tree is given
             *  40
             *  / \
             * 10     30
             * /         \
             * 5         28 */
            int[] inorder = new int[] { 5, 10, 40, 30, 28 };
            int   len     = inorder.Length;
            Node  mynode  = tree.buildTree(inorder, 0,
                                           len - 1, tree.root);

            /* Let us test the built tree by
             * printing Inorder traversal */
            Console.WriteLine("Inorder traversal of " +
                              "the constructed tree is ");
            Console.Read();
            tree.printInorder(mynode);
        }