剑指offer 左右翻转二叉树

Posted theodoric008

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了剑指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);
    }
};

以上是关于剑指offer 左右翻转二叉树的主要内容,如果未能解决你的问题,请参考以下文章