node* LCA(node *root, node *n1, node *n2, int &x) { int y = 0; node *temp;
if (root->left) temp = LCA(root->left, n1, n2, y); x += y; if (temp != NULL) return temp; if (x == 2) return node; if (root->right) temp = LCA(root->right, n1, n2, y); x += y; if (temp != NULL) 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.