
思路
方法:先序遍历,递归
1 class Solution {
2 public:
3 TreeNode* mirrorTree(TreeNode* root) {
4 if(root == NULL) {
5 return NULL;
6 }
7
8 TreeNode* tmp = mirrorTree(root->left);
9 root->left = mirrorTree(root->right);
10 root->right = tmp;
11
12 return root;
13 }
14 };