二叉树的镜像

题目描述

操作给定的二叉树,将其变换为源二叉树的镜像。
public class Solution {
    public void Mirror(TreeNode root) {
        if (root == null)
            return;
        if (root.left == null && root.right == null)
            return;
        TreeNode tn = root.left;
        root.left = root.right;
        root.right = tn;
        Mirror(root.left);
        Mirror(root.right);
    }
}
posted @ 2018-10-12 10:10  MarkLeeBYR  阅读(102)  评论(0)    收藏  举报