public void RootIsLca() { var x = exampleTree.Find(13); var y = exampleTree.Find(41); var lca = exampleTree.Find(19); Assert.Equal(lca, Q04 <int> .FindLowestCommonAncestor(exampleTree, x, y)); }
public void BiggerNodeIsLca() { var x = exampleTree.Find(31); var y = exampleTree.Find(43); var lca = exampleTree.Find(43); Assert.Equal(lca, Q04 <int> .FindLowestCommonAncestor(exampleTree, x, y)); }
public void Example() { var nodeC = exampleTree.Find(3); var nodeG = exampleTree.Find(17); var lca = exampleTree.Find(7); Assert.Equal(3, nodeC.Value); Assert.Equal(17, nodeG.Value); Assert.Equal(7, lca.Value); Assert.Equal(lca, Q04 <int> .FindLowestCommonAncestor(exampleTree, nodeC, nodeG)); }