思路
- 先交换左右子树的子树
- 再交换左右子树
代码
struct TreeNode* mirrorTree(struct TreeNode* root){
if(root==NULL)
return root;
mirrorTree(root->left);
mirrorTree(root->right);
struct TreeNode* temp=root->left;
root->left = root->right;
root->right = temp;
return root;
}