www

导航

树的镜像

public class Solution {
  public void Mirror(TreeNode root) {
      if(root == null) return;
      TreeNode temp = root.left;
      root.left = root.right;
      root.right = temp;
      Mirror(root.left);
      Mirror(root.right);
  }
}

 

posted on 2019-02-28 14:03  www_practice  阅读(127)  评论(0编辑  收藏  举报