剑指offer:镜像二叉树

一、问题描述

 将源二叉树转换成镜像二叉树,主要是左右节点互换

二、代码实现:

class Solution:

    def Mirror(self, root):
        # write code here
        if not root:
            return root
        root.left,root.right=root.right,root.left
        self.Mirror(root.left)
        self.Mirror(root.right)
        return root
原文地址:https://www.cnblogs.com/liuxiangyan/p/14373680.html