Given values of two nodes in a Binary Search Tree, write a c program to find the Lowest Common Ancestor (LCA). You may assume that both the values exist in the tree. You can assume that the nodes are present in the tree.
By the definition of BST, all nodes in the left sub-tree is smaller than the root, and all elements of the right sub-tree is greater than the root. So, if we start from root, if root is in between the input nodes then root is the answer, otherwise both input nodes are part of left sub-tree or both are parts of right sub-tree. We perform this operation recursively.