To find least common ancestor in a binary search tree
Anónimo
Have a recursive method with the root and the two values were trying to find the LCA for in the parameter. Because this is a binary search tree we know that the LCA will be the node where value 1 is less than and where value 2 is greater than. So you will return the root when the the case stated above is true. And then two statements after will either go to the left or right child depending on if the values are both greater than or less than.