作者 Hoogle, 火龙果软件 发布于:2014-01-23有人在Stack
Overflow上发问,动手开发网站之前,需要知道哪些事情?不出意料地,他得到了一大堆回答。通常情况下,你需要把所有人的发言从头到尾读一遍。但是,Stack
Overflow有一个很贴心的设计,它允许在问题下方开设一个w...
分类:
Web程序 时间:
2014-05-24 06:41:46
阅读次数:
448
Design and implement a data structure for Least
Recently Used (LRU) cache. It should support the following
operations:getandset.get(key)- Get the valu...
分类:
其他好文 时间:
2014-05-23 09:59:05
阅读次数:
257
其实我觉得这题可以用费用流的,可是光建图就超时了。。。不科学啊。。。因为边太多了,不然一定能过的,最后想啊想,还是用dp吧。。。。
居然想到一种一维dp。。。。我也不知道我怎么想的,反正就是ac了
//#pragma comment(linker, "/STACK:102400000,102400000")
#include
#include
#include
#include
#includ...
分类:
其他好文 时间:
2014-05-22 13:20:14
阅读次数:
286
??
A Stack or A Queue?
Time Limit:
1 Second Memory Limit: 32768 KB
Do you know stack and queue? They're both important data structures. A stack is a "first in last out" (FILO) data ...
分类:
其他好文 时间:
2014-05-22 12:24:38
阅读次数:
236
【题目】
原文:
2.2 Implement an algorithm to find the nth to last element of a singly linked list.
译文:
实现一个算法从一个单链表中返回倒数第n个元素。
【分析】
【思路一】
(1)创建两个指针p1和p2,指向单链表的开始节点。
(2)使p2移动n-1个位置,使之指向从头...
分类:
其他好文 时间:
2014-05-22 09:03:53
阅读次数:
315
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 t...
分类:
其他好文 时间:
2014-05-22 07:25:32
阅读次数:
254
2 stacks to implement a queue.
分类:
其他好文 时间:
2014-05-22 02:25:01
阅读次数:
230
#include #include #include using namespace std;int
main(){ int n; while(cin >> n) { stack one; string od1,od2; bool stat...
分类:
其他好文 时间:
2014-05-21 23:48:58
阅读次数:
370