h****n 发帖数: 1093 | 1 大家都知道像google那种的searching box的提示一般都是trie这种数据结构
然后面试官又提了一个要求,举个例子:如果字典里有个常用词 crack the coding
interview
输入“coding interview”要求下面的提示中有 crack the coding interview
你怎么设计,用什么数据结构
这个follow up没回答好,贡献出来给大家讨论讨论 |
a*******y 发帖数: 1040 | 2 if you have inverted index, you can find all of the other string which are
greater than your input string, you can do this by hashmap storing the
string to string mapping, the second string contains the first string |
f*****e 发帖数: 2992 | 3 后缀树的node指向起头的node?然后parent。
【在 h****n 的大作中提到】 : 大家都知道像google那种的searching box的提示一般都是trie这种数据结构 : 然后面试官又提了一个要求,举个例子:如果字典里有个常用词 crack the coding : interview : 输入“coding interview”要求下面的提示中有 crack the coding interview : 你怎么设计,用什么数据结构 : 这个follow up没回答好,贡献出来给大家讨论讨论
|
h****n 发帖数: 1093 | 4 你这个方法内存开销太大了
本来用trie就是为了避免保存一个一个phrase
【在 a*******y 的大作中提到】 : if you have inverted index, you can find all of the other string which are : greater than your input string, you can do this by hashmap storing the : string to string mapping, the second string contains the first string
|