@jalal hi You Can Use This algorithm to construct the Mirror tree
(1) Call Mirror for left-subtree i.e., Mirror(left-subtree)
(2) Call Mirror for right-subtree i.e., Mirror(left-subtree)
(3) Swap left and right subtrees.
temp = left-subtree
left-subtree = right-subtree
right-subtree = temp
then compare inorder traversal of two tree if they are in reverse
order then they are Mirror Tree else not
one can easily visualize it
You Can Find Out The Code here slightly modification need in this
because i put it here in hurry
1 Longer & better explantion http://codepad.org/aKoC2EyK
2. shorter version http://codepad.org/e7V1CjuY Might have some bugs
Thanks & Regards
Shashank Mani "The Best Way to Escape from the problem is to solve it
"
--
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.