public static void printNode(node root) { int maxLevel = BinaryTreePrinter.maxLevel(root); printNodeInternal(new List <node>() { root }, 1, maxLevel); }
private static int maxLevel(node node) { if (node == null) { return(0); } return(Math.Max(BinaryTreePrinter.maxLevel(node.LeftChild), BinaryTreePrinter.maxLevel(node.RightChild)) + 1); }