剑指offer (18)

题目 :
操作给定的二叉树,将其变换为源二叉树的镜像。

思路 : 此题简单 ,不做过多赘述

	public void mirror (TreeNode root) {
		if (root == null) {
			return;
		}
		else {
			TreeNode node = root.left;
			root.left = root.right;
			root.right = node;
			mirror(root.left);
			mirror(root.right);
		}
	}
发布了50 篇原创文章 · 获赞 0 · 访问量 409

猜你喜欢

转载自blog.csdn.net/weixin_46108108/article/details/104198566