由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 如何design google suggest
相关主题
码工小菜鸟谈onsiteG家面题
过去n小时的top search现在google是不是都要问design题啊?
上午偷闲把TopKFrequentWords写出来了求教一个电话簿的设计问题(双向查询 自动提示)
讨论一道题求问一道面试题
关于MAP REDUCE问大家一个cpp中function pointer的问题
请教关于build heap BIG-O的问题一套算法题
bloomberg面经+offer, 有没有交流下工资的?Two-Sigma面经
问2个BB面试问题也上一道算法题了(俺的版权了:))
相关话题的讨论汇总
话题: minheap话题: trie话题: db话题: each话题: node
进入JobHunting版参与讨论
1 (共1页)
z**********g
发帖数: 209
1
讨论一下如何design google suggest. 抛砖引玉。
我想基本的structure应该是trie + minheap.
First, we need to assume that popular search phases' search frequencies are
known. I think this can be achieved by map reduce easily, and the result is
stored at a database called DB.
Then, build a trie according to those popular search phases. Each node in
the trie has a pointer to a minHeap. The minHeap has a fixed size of 10.
Each node in minHeap stores a word and its frequency.
Suppose we want to insert a word craigslist into the trie, we need to update
every node's minHeap along the path, namely c, cr, cra, crai, craig, craigs
, craigsl, cragisli, cragislis and craigslist.
Please note this approach builds the trie according to DB statically,
and I think we need to reconstruct a new trie according to new DB every
month.
1 (共1页)
进入JobHunting版参与讨论
相关主题
也上一道算法题了(俺的版权了:))关于MAP REDUCE
攒人品,twitter电话面经请教关于build heap BIG-O的问题
Amazon电面面经bloomberg面经+offer, 有没有交流下工资的?
Facebook Interview Questions问2个BB面试问题
码工小菜鸟谈onsiteG家面题
过去n小时的top search现在google是不是都要问design题啊?
上午偷闲把TopKFrequentWords写出来了求教一个电话簿的设计问题(双向查询 自动提示)
讨论一道题求问一道面试题
相关话题的讨论汇总
话题: minheap话题: trie话题: db话题: each话题: node