1 class Solution { 2 public: 3 void Mirror(TreeNode *pRoot) { 4 if(pRoot==NULL){ 5 return; 6 } 7 if(pRoot -> left==NULL&&pRoot ->right==NULL){ 8 return; 9 } 10 TreeNode *temp = pRoot -> left; 11 pRoot -> left = pRoot -> right; 12 pRoot -> right = temp; 13 if(pRoot -> left!=NULL){ 14 Mirror(pRoot -> left); 15 } 16 if(pRoot -> right!=NULL){ 17 Mirror(pRoot -> right); 18 } 19 } 20 };