摘要:
public class TreeLevel { public ListNode getTreeLevel(TreeNode root, int dep) { // write code here List result = new ArrayList(); ... 阅读全文
posted @ 2015-12-22 20:36
仔细思考一切
阅读(216)
评论(0)
推荐(0)
摘要:
1,并没有把高度和建表结合了。而是最后才算。下一次可以想想怎么结合到一块去。1,建表(参考自书本) private static TreeNode createMinimalBST(int arr[], int start, int end){ if (end < start) ... 阅读全文
posted @ 2015-12-22 17:39
仔细思考一切
阅读(601)
评论(0)
推荐(0)
摘要:
//这道题AC了,但是并不确定是否完全正确。此外要注意因为是有向图,所以既要检查a到b,还要检查b到apublic class Path { public boolean checkPath(UndirectedGraphNode a, UndirectedGraphNode b) { ... 阅读全文
posted @ 2015-12-22 16:06
仔细思考一切
阅读(220)
评论(0)
推荐(0)
摘要:
//也就是把高度在递归过程中给一并算了。public class Balance { public static boolean checkBalance(TreeNode root, int[] dep){//java 里没有传地址if(null == root){dep[0] = 0;re... 阅读全文
posted @ 2015-12-22 14:22
仔细思考一切
阅读(182)
评论(0)
推荐(0)

浙公网安备 33010602011771号