Create Mirror of Binary Tree

Mirror Tree

Given a Binary Tree, convert it into its mirror
Algorithm:
  1. Traverse tree in PreOrder
    1. If node is null then
      1. return null
    2. Create mirror_node with original_node.data
    3. mirror_node.left = recursively call with original_node.right
    4. mirror_node.right = recursively call with original_node.left
    5. return mirror_node

Latest Source Code:
Github: BinaryMirrorTreeCreator.java


Output:

  1       
  / \   
 /   \  
 3   2   
    / \ 
    5 4 
                
Mirror Tree: 
   1       
  / \   
 /   \  
 2   3   
/ \     
4 5     
           
Author: Hrishikesh Mishra