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

            bst = ConstructTree(5, 4, 8,1,12,6,20,10);
            Assert.AreEqual(20, bst.MaxValue(bst.RootNode));

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

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