#思路:可以事先画图,先前序遍历,遇到有子节点就交换两个子节点,当交换完所有的子节点之后就得到了镜像树
def TreeMirror(root):
if root is None or (root.left is None and root.right is None):
return
root.left,root.right = root.right,root.left
TreeMirror(root.left)
TreeMirror(root.right)
return root