avatar
请教一道Google面试题# JobHunting - 待字闺中
S*n
1
Design a efficient cache, supporting retrieval of
maximum element in cache along with other normal cache
operations.
Suggest data structures to be used,also tell the
complexities for each of the operations
没什么好的idea, 哪位高手分享一下
avatar
f*4
2
是指那种传统意义上的associative的cache?还是就一个set,简单LRU的cache啊?
avatar
S*n
3
题目没说,就假设是associative的?

LRU的cache啊?

【在 f*******4 的大作中提到】
: 是指那种传统意义上的associative的cache?还是就一个set,简单LRU的cache啊?
avatar
L*g
4
这是不是career cup 里的那题目?
avatar
s*t
5
应该不外乎,doublelinked list + hashmap, 或hashmap+hashmap,具体看要求。版
上以前有讨论,可以翻翻看看。

【在 S******n 的大作中提到】
: Design a efficient cache, supporting retrieval of
: maximum element in cache along with other normal cache
: operations.
: Suggest data structures to be used,also tell the
: complexities for each of the operations
: 没什么好的idea, 哪位高手分享一下

avatar
S*n
6
谢谢

hashmap+hashmap,具体看要求。版

【在 s*******t 的大作中提到】
: 应该不外乎,doublelinked list + hashmap, 或hashmap+hashmap,具体看要求。版
: 上以前有讨论,可以翻翻看看。

avatar
g*s
7
用那个min stack的思路不行吗?

【在 S******n 的大作中提到】
: Design a efficient cache, supporting retrieval of
: maximum element in cache along with other normal cache
: operations.
: Suggest data structures to be used,also tell the
: complexities for each of the operations
: 没什么好的idea, 哪位高手分享一下

avatar
P*l
8
http://www.sureinterview.com/shwqst/903001
http://www.sureinterview.com/schlsc?q=max+queue
http://www.sureinterview.com/shwqst/124003
http://www.sureinterview.com/schlsc?q=cache
想了一下,觉得http://www.sureinterview.com/shwqst/903001还是可以处理这种要求的。
cache的get要特殊处理一下。就是把对应的值从两个队列里直接删除,然后当成新值插
回到队列里。

【在 g*********s 的大作中提到】
: 用那个min stack的思路不行吗?
avatar
S*n
9
thanks

http://www.sureinterview.com/shwqst/903001还是可以处理这种
要求的。
然后当成新值插

【在 P********l 的大作中提到】
: http://www.sureinterview.com/shwqst/903001
: http://www.sureinterview.com/schlsc?q=max+queue
: http://www.sureinterview.com/shwqst/124003
: http://www.sureinterview.com/schlsc?q=cache
: 想了一下,觉得http://www.sureinterview.com/shwqst/903001还是可以处理这种要求的。
: cache的get要特殊处理一下。就是把对应的值从两个队列里直接删除,然后当成新值插
: 回到队列里。

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。