剑指offer 左右翻转二叉树

class Solution {
public:
    void Mirror(TreeNode *pRoot) {
        if(pRoot == nullptr) return;
        cout << pRoot->val << endl;
        auto temp = pRoot->left;
        pRoot->left = pRoot->right;
        pRoot->right = temp;
        Mirror(pRoot->left);
        Mirror(pRoot->right);
    }
};

posted @ 2018-08-25 23:19  一条图图犬  阅读(109)  评论(0编辑  收藏  举报