【问题描述】
操作给定的二叉树,将其变换为源二叉树的镜像。
输入描述:
二叉树的镜像定义:源二叉树
8
/ \
6 10
/ \ / \
5 7 9 11
镜像二叉树
8
/ \
10 6
/ \ / \
11 9 7 5
【AC代码】

1 /**
2 public class TreeNode {
3 int val = 0;
4 TreeNode left = null;
5 TreeNode right = null;
6
7 public TreeNode(int val) {
8 this.val = val;
9
10 }
11
12 }
13 */
14 public class Solution {
15 public void Mirror(TreeNode root) {
16 if (root == null) return;
17 TreeNode tmp = root.left;
18 root.left = root.right;
19 root.right = tmp;
20 Mirror(root.left);
21 Mirror(root.right);
22 }
23 }
来源:https://www.cnblogs.com/moongazer/p/11669518.html
