public void TestGetMaxDepthofBinaryTree() { var root = TreeNode.BuildBSTFromArray(new int[] { 3, 1, 2, 4, 5, 6, 7, 8, 20, 11, 12, 13, 14, 15 }); var r = MaximumDepthofBinaryTree.GetDepth(root); Assert.AreEqual(r, 12); }
public void TestMethod2() { // Arrange MaximumDepthofBinaryTree question = new MaximumDepthofBinaryTree(); int expected = 0; // Act int actual = question.MaxDepth(null); // Assert Assert.AreEqual(expected, actual); }
public void TestMethod3() { // Arrange MaximumDepthofBinaryTree question = new MaximumDepthofBinaryTree(); TreeNode root = new TreeNode(3); int expected = 1; // Act int actual = question.MaxDepth(root); // Assert Assert.AreEqual(expected, actual); }
public void TestMethod1() { // Arrange MaximumDepthofBinaryTree question = new MaximumDepthofBinaryTree(); TreeNode 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); int expected = 3; // Act int actual = question.MaxDepth(root); // Assert Assert.AreEqual(expected, actual); }