翻转二叉树或镜像二叉树

TreeNode mirrorTreeNode(TreeNode root){
        if(root == null){
            return null;
        }
        TreeNode left = mirrorTreeNode(root.left);
        TreeNode right = mirrorTreeNode(root.right);
        root.left = right;
        root.right = left;
        return root;
    }


 

posted @ 2018-07-10 09:19  樱圃  阅读(219)  评论(0编辑  收藏  举报