题目链接。实现一个数据结构用于LRU,最近最少使用,O(1)插入和删除。关于LRU的基本知识可参考here。先推荐JustDoIT的。下面是我自己实现的。class LRUCache{public://146LRU Least Recently Used int LRUsize; str...
分类:
系统相关 时间:
2014-12-15 00:00:46
阅读次数:
557
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the contiguous subarray [4,?1,2,1] ha...
分类:
其他好文 时间:
2014-12-12 19:12:27
阅读次数:
205
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the...
分类:
系统相关 时间:
2014-12-12 01:11:43
阅读次数:
374
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the...
分类:
其他好文 时间:
2014-12-11 20:49:19
阅读次数:
177
设计并实现最近最久未使用(Least Recently Used)缓存。链接:https://oj.leetcode.com/problems/lru-cache/题目描述:Design and implement a data structure for Least Recently Used (...
分类:
系统相关 时间:
2014-12-09 15:32:34
阅读次数:
320
NG的课件1,引出常用的优化方法梯度下降法(gradient descent) 对于 ordinary least squares regression, cost function为 求最小值,意味着求导数为0的位置 考虑只有一个样本 这叫做LMS update rule (Least Mean ...
分类:
其他好文 时间:
2014-12-09 08:11:49
阅读次数:
330
LRU: least recently used(近期最少使用算法)。LinkedHashMap构造函数可以指定其迭代顺序:LinkedHashMap(intinitialCapacity, floatloadFactor, booleanaccessOrder)设置accessOrder为true...
分类:
其他好文 时间:
2014-12-08 19:20:09
阅读次数:
209
LRUCache解释
LRUCache就是一个缓存系统,主要是在操作系统中用的比较多,我这里实现的仅仅是一个简单的方法,原理是正确的,但是操作系统的内部的缓存代码我并没有看过。
LRU是Least Recently Used的意思,Cache大家都知道是缓存的意思了。就是在缓存里保存最近最常使用的元素,这样访问这些元素的时候,速度就比较快的能访问到了。
缓存里存放的一般都是键值对...
分类:
编程语言 时间:
2014-12-07 13:48:37
阅读次数:
190
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the...
分类:
其他好文 时间:
2014-12-06 15:19:13
阅读次数:
199
原资源链接为:Bitmark
其中各个模块代表的含义:
- Set S: 初始值s
- Set bit(j): s or 第j位
- Check bit(j):s and 第j位
- Toggle bit(j):s xor 第j位(相同的bit为0,不同则为1)
- Clear bit(j位不为1): and 运算
- Least ...
分类:
其他好文 时间:
2014-12-04 20:06:09
阅读次数:
789