data structure
文章平均质量分 52
yoohoosome
这个作者很懒,什么都没留下…
展开
-
[刷题]LRU Cache
[LintCode]LRU Cachepublic class Solution { // 哈希表是一个索引表,索引所有Node // 哈希表的key和Node的key相同 // Node之间用双向链表维护 private int capacity; private HashMap map = new HashMap(); private No原创 2015-09-01 15:23:15 · 214 阅读 · 0 评论 -
[刷题]Min Stack
[LintCode]Min Stackpublic class Solution { Stack stack; Stack minStack; public Solution() { // 2015-09-04 stack = new Stack<>(); minStack = new Stack<>();原创 2015-09-04 19:33:08 · 239 阅读 · 0 评论 -
[刷题]Hash Function
[LintCode]Hash Functionclass Solution { /** * @param key: A String you should hash * @param HASH_SIZE: An integer * @return an integer */ public int hashCode(char[] key,i原创 2015-09-04 20:09:08 · 338 阅读 · 0 评论 -
[刷题]Max Tree
[LintCode]Max Tree/** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int val) { * this.val = val; *原创 2015-09-02 16:14:22 · 322 阅读 · 0 评论 -
[刷题]Largest Rectangle in Histogram
[LintCode]Largest Rectangle in Histogrampublic class Solution { /** * @param height: A list of integer * @return: The area of largest rectangle in the histogram */ public int原创 2015-09-02 15:32:37 · 240 阅读 · 0 评论 -
[刷题]Data Stream Median
[LintCode]Data Stream Medianpublic class Solution { /** * @param nums: A list of integers. * @return: the median of numbers */ public int[] medianII(int[] nums) { // w原创 2015-09-02 10:17:57 · 345 阅读 · 0 评论 -
[刷题]Longest Consecutive Sequence
[LintCode]Longest Consecutive Sequencepublic class Solution { /** * @param nums: A list of integers * @return an integer */ public int longestConsecutive(int[] num) {原创 2015-09-01 10:03:59 · 235 阅读 · 0 评论 -
[刷题]Heapify
[LintCode]Heapifypublic class Solution { /** * @param A: Given an integer array * @return: void */ public void heapify(int[] A) { // 从树的最后一个点开始,一层一层地向上遍历 for (原创 2015-08-31 15:12:08 · 297 阅读 · 0 评论 -
[刷题]Rehashing
[LintCode]Rehashing/** * Definition for ListNode * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * }原创 2015-09-01 09:37:28 · 314 阅读 · 0 评论 -
[刷题]Implement Queue by Two Stacks
[LintCode]Implement Queue by Two Stackspublic class Solution { private Stack stack1; private Stack stack2; public Solution() { // 2015-09-03 stack1 = new Stack<>();原创 2015-09-03 17:36:41 · 227 阅读 · 0 评论