public void TesBalancedTree() { var root = new TreeNode(3); root.Left = new TreeNode(9); root.Right = new TreeNode(20); root.Right.Left = new TreeNode(15); root.Right.Right = new TreeNode(7); var r = BalancedTree.IsBalanced(root); Assert.AreEqual(r, true); root = new TreeNode(1); root.Left = new TreeNode(2); root.Right = new TreeNode(2); root.Left.Left = new TreeNode(3); root.Left.Right = new TreeNode(3); root.Left.Left.Left = new TreeNode(4); root.Left.Left.Right = new TreeNode(4); r = BalancedTree.IsBalanced(root); Assert.AreEqual(r, false); }