コード例 #1
0
        public void FindSumPath_ForTestData_ReturnRightPath()
        {
            BinaryTree <int> tree = PreOrderTreeWalkerBuilder.Build(PreOrderTreeTestDataBuilder.GetTreeInPreOrder());

            SumPathFinder finder = new SumPathFinder(tree);

            List <int> path = finder.FindPath(1940);

            Assert.That(path, Is.EqualTo(new [] { 490, 258, 366, 424, 402 }));
        }
コード例 #2
0
        public void BuildTree_FromPreOrderSequenceOnTestData_ReturnsCorrectBinarySearchTree()
        {
            BinaryTree <int> tree = PreOrderTreeWalkerBuilder.Build(PreOrderTreeTestDataBuilder.GetTreeInPreOrder());

            Assert.That(tree.IsBinarySearchTree(), Is.True);
        }