Solution Review: Copy Mirror Tree

Let's analyze in detail how to create a mirror tree using the original binary tree.

Solution

We create a mirror image of a tree the same way we copy a tree. The only difference here is that in place of the left child pointing to the tree that is formed by the left child traversal of the input tree, this time the left child points to the tree formed by the right child traversal of the input tree. Similarly, the right child points to the tree formed by the traversal of the left child of the input tree.

Get hands-on with 1400+ tech skills courses.