예제 #1
0
        public void BinaryTree_LCA_NotExist()
        {
            var root   = this.CreateTestTree();
            var t      = new BinaryTree <int>(root);
            var result = t.LCA(root, 8, 10);

            result.Should().BeNull("result should be null.");
        }
예제 #2
0
        public void BinaryTree_LCA()
        {
            var root   = this.CreateTestTree();
            var t      = new BinaryTree <int>(root);
            var result = t.LCA(root, 4, 7);

            result.Should().NotBeNull("result should not be null.");
            result.Value.Should().Be(2, "Incorrect LCA.");
        }