Question: Question: Given a 2 binary trees root nodes, check if the structure is mirror to each other. Example: Consider the image given below and its

Question:

Given a 2 binary trees root nodes, check if the structure is mirror to each other.


Example:

Consider the image given below and its mirror.

7 10 15 16 18 25 30 30 20 40 www.ProDeveloper Tutorial.com



Check if Two Trees are Mirror Structure to each other

If you can see in the above image, both the trees structure are mirror to each other.


We don’t consider the node elements, we just consider the structure.


So to solve this problem, we need to check if right node is present in tree 1, then left node should be present in tree 2 and vice versa.


By doing so we can check if both of the trees have mirror structure.

7 10 15 16 18 25 30 30 20 40 www.ProDeveloper Tutorial.com 10 60 50 70

Step by Step Solution

3.32 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed answer for the above question is provided below include include include using namesp... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!