public static void Main(string[] args) { string rawTree = Console.ReadLine(); BiTrNode root = ParseTree(rawTree); BiTree tree = new BiTree(root); Console.WriteLine(tree.IsIdeallyBalanced()); }
public BiTree(int value, BiTree leftChild, BiTree rightChild) { if (value == null) { throw new ArgumentNullException("Cannot insert null value!"); } BiTrNode leftChildNode = leftChild != null ? leftChild.root : null; BiTrNode rightChildNode = rightChild != null ? rightChild.root : null; this.root = new BiTrNode(value, leftChildNode, rightChildNode); }