avatar
狗也上树了# pets - 心有所宠
h*u
1
上百万的字符串 , 每个小于 128 char.
设计data structure处村. 要支持 fast prefix search(return all strings with
given prefix)
coding is to implement insert method. input is a stream of strings. it needs
to be fast.
First response was a tire, but interviewer not happy with every insert start
from root of the tire tree, ask if the input can be pre-processed (like
sort), any way to speed it up.
found with the tire, even string stream was sorted, still need a O(k) k is
length of string comparison during track back. so no performance gain.
any ideas?
avatar
o*i
2
...?
其实是骗你们的...
★ 发自iPhone App: ChineseWeb - 中文网站浏览器
avatar
e*t
3
hash the prefixes? keep index in the hash table,
then retrieve the strings in the array based on matching index

needs
start
is

【在 h***u 的大作中提到】
: 上百万的字符串 , 每个小于 128 char.
: 设计data structure处村. 要支持 fast prefix search(return all strings with
: given prefix)
: coding is to implement insert method. input is a stream of strings. it needs
: to be fast.
: First response was a tire, but interviewer not happy with every insert start
: from root of the tire tree, ask if the input can be pre-processed (like
: sort), any way to speed it up.
: found with the tire, even string stream was sorted, still need a O(k) k is
: length of string comparison during track back. so no performance gain.

avatar
l*8
4
少见多怪.

【在 o****i 的大作中提到】
: ...?
: 其实是骗你们的...
: ★ 发自iPhone App: ChineseWeb - 中文网站浏览器

avatar
s*n
5
if sorted, then it is a kind of tree travesal.
like.
abc
abcd
abd
abdd
a
b
c d
d d
then it is O(number of nodes) complexity.

needs
start
is

【在 h***u 的大作中提到】
: 上百万的字符串 , 每个小于 128 char.
: 设计data structure处村. 要支持 fast prefix search(return all strings with
: given prefix)
: coding is to implement insert method. input is a stream of strings. it needs
: to be fast.
: First response was a tire, but interviewer not happy with every insert start
: from root of the tire tree, ask if the input can be pre-processed (like
: sort), any way to speed it up.
: found with the tire, even string stream was sorted, still need a O(k) k is
: length of string comparison during track back. so no performance gain.

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