int isAncestor(struct node* root, int n)
{
if(root == NULL)
return 0;
if(root->data == n)
return 1;
if(isAncestor(root->left, n) || isAncestor(root->right, n))
{
printf("%d\n", root->data);
return 1;
}
return 0;
}
No comments:
Post a Comment