Node *LCA(node *root, node *e1, node *e2, int &x)
{
Node *temp =NULL;
Int y = 0;
If (root->left) temp = LCA(root->left, e1, e2, y);
x+=y;
if (temp) return temp;
if (x==2) return node;
y = 0;
If (root->right) temp = LCA(root->right, e1, e2, y);
x+=y;
if (temp) return temp;
if (x==2) return node;
If (root == e1 || root == e2) x++;
Return null;
}
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.