上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 28 下一页
摘要: HashMap实现原理及源码分析 哈希表(hash table)也叫散列表,是一种非常重要的数据结构,应用场景及其丰富,许多缓存技术(比如memcached)的核心其实就是在内存中维护一张大的哈希表,而HashMap的实现原理也常常出现在各类的面试题中,重要性可见一斑。本文会对java集合框架中的对 阅读全文
posted @ 2017-07-29 15:08 apanda009 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 一维数组解题的三种方法: 双指针\ 队列 栈 堆\ 动归\二分法\hashmap Partition 题—以quicksort 为模板--O(n) 出题点: 如何Patition ? 二分递归的部分 前向型指针 – O(n) 窗口类指针常用到的数据结构是 int sum, hashmap, hash 阅读全文
posted @ 2017-07-29 14:07 apanda009 阅读(161) 评论(0) 推荐(0) 编辑
摘要: merge sort 阅读全文
posted @ 2017-07-28 16:09 apanda009 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 0. Trie数据结构,也就是前缀树。然后dfs时,如果当前形成的单词不在Trie里,就没必要继续dfs下去了。如果当前字符串在trie里,就说明board可以形成这个word。 这道题很好的体现了Trie的优势:不用Trie, 我们就得把String[] words里面的word一个一个去boar 阅读全文
posted @ 2017-07-28 12:10 apanda009 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 键值对想到hashmap, 增删节点考虑链表, + 头尾节点, 因此要构造相应的类 双向链表需要头尾节点 The problem can be solved with a hashtable that keeps track of the keys and its values in the dou 阅读全文
posted @ 2017-07-26 21:44 apanda009 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 为啥用栈, 数组相对顺序不能变, 要找第一个比当前元素小的元素, 或大的元素, 同84. Largest Rectangle in Histogram 同84. Largest Rectangle in Histogram 在数组后面加"0", 这些操作都是为了遍历所有的元素, 有的不需要遍历所有的 阅读全文
posted @ 2017-07-26 21:18 apanda009 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 遍历, 没用到bst的性质: 递归 阅读全文
posted @ 2017-07-26 15:19 apanda009 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Iterative做法 分治法: Recursion做法: 阅读全文
posted @ 2017-07-26 13:24 apanda009 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 用bst的性质遍历就行了: Just walk down from the whole tree's root as long as both p and q are in the same subtree (meaning their values are both smaller or both 阅读全文
posted @ 2017-07-26 10:36 apanda009 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 分治法, 自己画个简图(三个, 两个节点), 遍历一下 会写树的高度, 在树的高度上加了个判断而已.别忘了左子树和右子树也是要查的 分治法主要在如何设计返回值, 和题意与返回值的转化, 递归出口1(判空), 最后的节点的出口2(或许加判断等), 分, 合: 将分好的左右节点作为单个节点, 进行题意的 阅读全文
posted @ 2017-07-26 09:26 apanda009 阅读(130) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 28 下一页