public void MaxDepth_TreeWithDepthOfThree_ReturnsThree() { var root = new TreeNode(1, new TreeNode(2, new TreeNode(3, null, null), null), null); var maximumDepth = new MaximumDepth(); Assert.That(maximumDepth.MaxDepth(root), Is.EqualTo(3)); }
public void MaxDepth_NullRoot_ReturnsZero() { TreeNode root = null; var maximumDepth = new MaximumDepth(); Assert.That(maximumDepth.MaxDepth(root), Is.EqualTo(0)); }
public void MaxDepth_OnlyRoot_ReturnsOne() { TreeNode root = new TreeNode(1); var maximumDepth = new MaximumDepth(); Assert.That(maximumDepth.MaxDepth(root), Is.EqualTo(1)); }
public void GetDepth() { var saka8 = new Saka(); var saka7 = new Saka(); var saka5 = new Saka(); var saka6 = new Saka(); var saka3 = new Saka(0, new List <Saka> { saka5, saka6, saka7, saka8 }); var saka2 = new Saka(); var saka4 = new Saka(); var saka1 = new Saka(0, new List <Saka> { saka3, saka2 }); Console.WriteLine("Max Depth = " + MaximumDepth.MaxDepth(saka1, 1000, 1)); Console.ReadKey(); }