예제 #1
0
        public void DepthZeroReturnRootNode()
        {
            Tree tree = CreateTree(3);
            TreeSearch search = new TreeSearch();

            Assert.AreEqual(3, search.FindMaxValue(tree, 0));
        }
예제 #2
0
        public void DepthZeroOnTreeWithChildren()
        {
            Tree tree = CreateTree(5, 3, 7);
            TreeSearch search = new TreeSearch();

            Assert.AreEqual(5, search.FindMaxValue(tree, 0));
        }
예제 #3
0
        public void DepthTwoOnTreeWithTwoLevelsOfChildren()
        {
            Tree tree = CreateTreeNodes(5, CreateTree(3, 5, 7), CreateTree(7, 9, 11));
            TreeSearch search = new TreeSearch();

            Assert.AreEqual(11, search.FindMaxValue(tree, 2));
        }
예제 #4
0
        public void DepthOneReturnRootNodeOnTreeWithoutChildren()
        {
            Tree tree = CreateTree(5);
            TreeSearch search = new TreeSearch();

            Assert.AreEqual(5, search.FindMaxValue(tree, 1));
        }
예제 #5
0
        public void DepthOneOnTreeWithOnlyTwoChildren()
        {
            Tree tree = CreateTree(5, 3, 7);
            TreeSearch search = new TreeSearch();

            Assert.AreEqual(7, search.FindMaxValue(tree, 1));
        }
예제 #6
0
        public void DepthOneOnTreeWithOnlyOneChild()
        {
            Tree tree = CreateTree(5, 3);
            TreeSearch search = new TreeSearch();

            Assert.AreEqual(3, search.FindMaxValue(tree, 1));
        }