bool isIsomorphic(List* h1,List* h2)
{
if(!h1 && !h2) return true;
if(h1 && h2)
return(h1->data == h2->data && isIsomorphic(h1->left,h2->right)
&& isIsomorphic(h1->right,h2->left));
else return false;
}
On Tue, Jun 8, 2010 at 8:31 PM, divya <[email protected]> wrote:
> Two binary trees T1 and T2 are isomorphic if T1 can be transformed
> into T2 swapping left and right children of the nodes in T1.Give an
> algorithm to report whether 2 given binary trees are isomorphic.
>
> --
> 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]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
Simplicity is prerequisite for reliability.
– Edsger W. Dijkstra
--
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.