Пример #1
0
        public static void Main(string[] args)
        {
            string   rawTree = Console.ReadLine();
            BiTrNode root    = ParseTree(rawTree);
            BiTree   tree    = new BiTree(root);

            Console.WriteLine(tree.IsIdeallyBalanced());
        }
Пример #2
0
        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);
        }