Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.



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

Step: 1

The detailed answer for the above question is provided below include include include using namesp... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Algorithms

Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest

3rd edition

978-0262033848

More Books

Students also viewed these Programming questions

Question

Subtract the polynomials. (-x+x-5) - (x-x + 5)

Answered: 1 week ago