This post is completed by 1 user
|
Add to List |
136. Verifying Mirror Binary Trees
Objective: - Given two binary trees check if they are a mirror images of each other.
Example:
![Check-If-One-Binary-is-Mirror-Tree-of-another-Binary-Tree](/static/media/algorithms/2015/03/Check-If-One-Binary-is-Mirror-Tree-of-another-Binary-Tree.png)
Approach:
- Do the preorder traversal on both the trees simultaneously.
- if any node doesn't have a corresponding node in another tree, return false.
- check if the left node in one tree is the right node in another tree and vice versa.
Is Mirror Trees : true