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."); }
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."); }