Approach Summary
Recursively compare left subtree's right children with right subtree's left children. Both must mirror each other.
How to Recognize This Pattern
- "Is the tree a mirror of itself"
- Compare outer-outer and inner-inner pairs simultaneously
Complexity Analysis
Time Complexity
O(n)
Space Complexity
O(h)
Tags
Tree DFS BFS Binary Tree