@Saurabh
I believe for Isomorphic trees only the structure counts not the value at
each nodes.
So i think there is no need to compare the value at the corresponding node
positions of the two trees.

On Wed, Jun 9, 2010 at 11:15 PM, saurabh gupta <[email protected]> wrote:

> is-isomorphic(t1, t2) {
>      t1ld = t1->left->data
>      t2ld = t2->left->data
>     //.....
>
>     //base case for null or replace by sentinels and check
>     if( t1ld == t2ld && t1rd == t2rd)
>        return is-isomorphic(t1ld, t2ld) && return is-isomorphic(t1rd, t2rd)
>     if (t1ld == t2rd && t1rd == t2ld)
>        return is-isomorphic(t1ld, t2rd) && return is-isomorphic(t1rd, t2ld)
>     return false;
>
> }
>
> On Wed, Jun 9, 2010 at 8:29 PM, divya jain <[email protected]>wrote:
>
>> @vadivel and anand
>>
>> { 1,2,3 } is *isomorphic* to { 1,3,2 }
>> { 1,2,3,4,5,6,7 } is *isomorphic* to { 1,3,2,7,6,4,5 }
>> { 1,2,3,4,5,6,7 } is NOT *isomorphic* to { 1,3,2,4,5,6,7 }
>>
>> so its nt necessary that right and left will interchange. it may or may
>> not. if all right and left are interchanged then it is mirror tree. i think
>> ur code is for mirror tree and not isomorphic tree..
>>
>>
>>  --
>> 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.
>>
>
>
>
> --
> Man goes to doctor. Says he's depressed. Says life seems harsh and cruel.
> Says he feels all alone in a threatening world where what lies ahead is
> vague and uncertain. Doctor says "Treatment is simple. Great clown
> Pagliacci is in town tonight. Go and see him. That should pick you up." Man
> bursts into tears. Says "But, doctor...I am Pagliacci."
>
>  --
> 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.
>

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