标签:pac public ror nbsp his ack tree 剑指offer 定义
package jianzhiOffer; /** * 操作给定的二叉树,将其变换为源二叉树的镜像。 * @author user * 二叉树的镜像定义:源二叉树 8 / 6 10 / \ / 5 7 9 11 镜像二叉树 8 / 10 6 / \ / 11 9 7 5 */ class TreeNode2 { int val = 0; TreeNode2 left = null; TreeNode2 right = null; public TreeNode2(int val) { this.val = val; } } public class ch18 { TreeNode2 tmp_node = null; public void Mirror(TreeNode2 root) { if(root == null) { return; } Mirror(root.left); Mirror(root.right); tmp_node = root.left; root.left = root.right; root.right = tmp_node; } }标签:pac public ror nbsp his ack tree 剑指offer 定义
原文地址:http://blog.51cto.com/12222886/2062676