Пример #1
0
        private static int maxLevel(Node node)
        {
            if (node == null)
            {
                return(0);
            }

            return(Math.Max(BinaryTreePrinter.maxLevel(node.LeftChild), BinaryTreePrinter.maxLevel(node.RightChild)) + 1);
        }
Пример #2
0
        public static void printNode(Node root)
        {
            int maxLevel = BinaryTreePrinter.maxLevel(root);

            printNodeInternal(new List <Node>()
            {
                root
            }, 1, maxLevel);
        }