QuestionlinkDesign and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- ...
分类:
系统相关 时间:
2015-08-13 08:54:53
阅读次数:
170
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 value (will always be positive) of the key if ...
分类:
系统相关 时间:
2015-08-10 20:02:52
阅读次数:
163
BST 以下BST的定义来自于Wikipedia: Binary Search Tree, is a node-based binary tree data structure which has the following properties: The left subtree of a nod...
分类:
编程语言 时间:
2015-08-10 19:41:15
阅读次数:
130
find the most comfortable roadProblem DescriptionXX星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级空中漫游结构)进行交流,每条SARS都对行驶在上面的Flycar限制了固定的Speed...
分类:
其他好文 时间:
2015-08-10 17:43:03
阅读次数:
120
借用LeetCode 208. Implement Trie (Prefix Tree)中设计的字典树,特判查询字符为.时的情况即可。
注意:
成员变量的初始化应放在构造函数的initializing list而不是body中,使成员变量只被初始化一次,没有被再次赋值;
使用shared_ptr代替裸指针来管理内存。
代码:
class TrieNode
{
public:
T...
分类:
其他好文 时间:
2015-08-10 12:06:32
阅读次数:
117
和排序算法一样,查找算法也是一种最为基本的算法。高效地查找可以使我们对数据进行更加高效地操作,熟练掌握各种查找算法也是一项基本的算法技能。
分类:
编程语言 时间:
2015-08-09 22:01:41
阅读次数:
236
排序算法是一种最为基础的算法,可以说无处不在,比如我们的搜索引擎中搜索排序。本文详细介绍了常见的八种排序算法,并附有C++源码实现。最后,针对各种排序算法的性能,进行了比较和分析。
分类:
编程语言 时间:
2015-08-09 15:26:37
阅读次数:
153
Design a data structure that supports the following two operations:
void addWord(word)
bool search(word)
search(word) can search a literal word or a regular expression string containing only letter...
分类:
其他好文 时间:
2015-08-09 12:36:57
阅读次数:
120
排序算法是一种最为基础的算法,可以说无处不在,比如我们的搜索引擎中搜索排序。本文详细介绍了常见的八种排序算法,并附有C++源码实现。最后,针对各种排序算法的性能,进行了比较和分析。
分类:
编程语言 时间:
2015-08-09 01:44:47
阅读次数:
247
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 value (will always be positive) of the key if ...
分类:
系统相关 时间:
2015-08-08 21:25:18
阅读次数:
261