lowest common ancestor

Given the values of two nodes in a *binary search tree*, write a c program to find the lowest common ancestor. You may assume that both values already exist in the tree.
The function prototype is as follows:
int FindLowestCommonAncestor(node* root, int value1, int value)
BST_LCA
I/P : 4 and 14
  O/P : 8
  (Here the common ancestors of 4 and 14, are {8,20}.
  Of {8,20}, the lowest one is 8).

Comments

Popular posts from this blog