Heyy, please check my function lca2 . It is giving run time error.
Runtime error.......)))))
@Aparna
Your second else if was incorrect
You copied the one above it without modifying it
else if(root->data==Q->data)
{
result->haskeyQ=true;
result->haskeyP=(LeftAns)?LeftAns->haskeyP:false || (RightAns)?RightAns->haskeyP:false;
if(result->haskeyQ==true && result->haskeyP==true)
result->Node=root;
return result;
}
Use this else if at line 117