예제 #1
0
        public void print()
        {
            var ctr  = new ConstructBinaryTree();
            var tree = ctr.Contruct(new [] { 10, 5, 4, 7, 12 }, new [] { 4, 5, 7, 10, 12 });

            FindPath(tree, 22);
        }
예제 #2
0
        public void print()
        {
            var constructor = new ConstructBinaryTree();
            var tree        = constructor.Contruct(new [] { 8, 81, 9, 2, 4, 7, 71 }, new [] { 9, 81, 4, 2, 7, 8, 71 });

            tree.PrintPreOrder();
            MirrorRecursively(tree);
            tree.PrintPreOrder();
        }
        public void print()
        {
            var ctr  = new ConstructBinaryTree();
            var tree = ctr.Contruct(new[] { 10, 5, 4, 7, 12 }, new[] { 4, 5, 7, 10, 12 });

            tree.ShowTree();

            System.Console.WriteLine(GetTreeDepth(tree));
            System.Console.WriteLine(IsBalance(tree, out _));
        }
예제 #4
0
        public void print()
        {
            var ctr  = new ConstructBinaryTree();
            var tree = ctr.Contruct(
                new int[] { 8, 6, 5, 7, 10, 9, 11 },
                new int[] { 5, 6, 7, 8, 9, 10, 11 }
                );

            // tree.PrintPreOrder();
            // tree.PrintInorder();

            PrintFromTopToBottom(tree);
        }