void Exchange(TreeNode*& T) { TreeNode* temp; if(T) { temp=T->left; T->left=T->right; T->right=temp; Exchange(T->left); Exchange(T->right); } } class Solution { public: TreeNode* Mirror(TreeNode* pRoot) { Exchange(pRoot); return pRoot; } };
void Exchange(TreeNode*& T) { TreeNode* temp; if(T) { temp=T->left; T->left=T->right; T->right=temp; Exchange(T->left); Exchange(T->right); } } class Solution { public: TreeNode* Mirror(TreeNode* pRoot) { Exchange(pRoot); return pRoot; } };