上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页
摘要: When you start JVM you define how much RAM it can use use for processing. JVM divides this into certain memory locations for its processing purpose, t 阅读全文
posted @ 2018-03-08 04:09 davidnyc 阅读(126) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2018-03-05 05:39 davidnyc 阅读(107) 评论(0) 推荐(0)
摘要: heapify unsorted array: n*logn -> o(n): 最贵的 o(logn) 操作集中在少数几个node 上 但heapify 并不是 sort, 左右并没有排序,如果需要排序的话,需要先heapify 然后再 一个一个的poll 时间复杂度是 on + onlogn = 阅读全文
posted @ 2018-03-05 04:16 davidnyc 阅读(301) 评论(0) 推荐(0)
摘要: 这道题首先要明确题目背景 二叉搜索树。也正是因为是二叉搜索树,所以我们可以利用二叉搜索树从小到大排好序的特性来做。 对于一个root和另外两个Node来说,它们的值会有以下几种情况: 1. root.val < p.val && root.val < q.val 此时,两个node的值都比root大 阅读全文
posted @ 2018-03-03 10:16 davidnyc 阅读(125) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/description/Given an array where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, ... 阅读全文
posted @ 2018-03-03 05:35 davidnyc 阅读(133) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/validate-binary-search-tree/description/Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a ... 阅读全文
posted @ 2018-03-02 10:49 davidnyc 阅读(97) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2018-03-01 13:16 davidnyc 阅读(85) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/binary-tree-longest-consecutive-sequence/description/Given a binary tree, find the length of the longest consecutive sequence path.The path refers to any sequence of node... 阅读全文
posted @ 2018-03-01 10:21 davidnyc 阅读(102) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/path-sum-ii/description/Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and ... 阅读全文
posted @ 2018-03-01 02:37 davidnyc 阅读(141) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/symmetric-tree/description/Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is ... 阅读全文
posted @ 2018-02-28 23:53 davidnyc 阅读(116) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页