Example #1
0
        public void MaxDepthTest()
        {
            BinarySearchTree<int> bst = ConstructTree(5, 4, 8);
            Assert.AreEqual(2, bst.MaxDepth(bst.RootNode));

            bst = ConstructTree(5);
            Assert.AreEqual(1, bst.MaxDepth(bst.RootNode));

            bst = new BinarySearchTree<int>();
            Assert.AreEqual(0, bst.MaxDepth(bst.RootNode));
        }