/*
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), left(NULL), right(NULL) {
}
};*/
class Solution {
public:
void Mirror(TreeNode *pRoot) {
TreeNode *temp=NULL;
if(pRoot!=NULL)
{
temp=pRoot->left;
pRoot->left=pRoot->right;
pRoot->right=temp;
if(pRoot->left!=NULL)
{
Mirror(pRoot->left);
}
if(pRoot->right!=NULL)
{
Mirror(pRoot->right);
}
}
}
};
剑指offer 二叉树的镜像
最新推荐文章于 2020-07-11 00:16:24 发布