Given 2 trees .Find wether second tree is the subtree of the first tree .

here is my soln corect me if i m wrong:

bool find(struct node * tree,struct node *subtree)
{

  if(tree==NULL )
 return ;


if(tree->data==subtree->data   && find(tree->left,subtree->left) &&
find(tree->right,subtree->right)  &&   (subtree->left)!=NULL &&
subtree->right
!=NULL)
 {
 return true;
}
else
 return false

find(tree->left,subtree);
find(tree->right,subtree);
}

-- 
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.

Reply via email to