摘要:
改造了一下maxdepth的代码 public static int minDepth(TreeNode root) { if(root==null) return 0; int height=0; Queue q=new LinkedList(); ... 阅读全文
posted @ 2015-06-24 20:03
hhrrrr
阅读(161)
评论(0)
推荐(0)
摘要:
问题描述: 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1递归反转:先反转根节点的左子树和右子树 然后再分别反转左子树,右子树各自的下的左子树右子树。依此类推... 阅读全文
posted @ 2015-06-24 12:05
hhrrrr
阅读(202)
评论(0)
推荐(0)
摘要:
非递归: public static int maxDepth(TreeNode root){ if(root==null) return 0; Queue q=new LinkedList(); q.offer(root); int enQu... 阅读全文
posted @ 2015-06-24 11:08
hhrrrr
阅读(168)
评论(0)
推荐(0)

浙公网安备 33010602011771号