二叉树的镜像定义:源二叉树
8
/ \
6 10
/ \ / \
5 7 9 11
镜像二叉树
8
/ \
10 6
/ \ / \
11 9 7 5
//递归
public TreeNode Mirror(TreeNode root)
{
// write code here
if (root == null)
{
return root;
}
else
{
TreeNode Temp = root.left;
root.left = root.right;
root.right = Temp;
Mirror(root.left);
Mirror(root.right);
return root;
}
}