由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 湾区公司店面
相关主题
请教一个phone interview 问题一道caeerCup上的难算法题
问一个 String array sorting 的题。菜鸟请教电面写code,能用哪些function,在线等
linked list排序的算法除了bubble问一个Pinterest的题目
Ask a google interview question(3)问个google老题的最佳解法
问一个关于stringstream的诡异问题G onsite题求讨论
linkedin今天的电面题HackerRank find string..
how to sort strings if alpha order is changed问个经典问题的improvement
回馈版面:Google Intern InterviewRiverbed 面经
相关话题的讨论汇总
话题: tire话题: strings话题: prefix话题: insert话题: stream
进入JobHunting版参与讨论
1 (共1页)
h***u
发帖数: 9
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?
e**t
发帖数: 39
2
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.

s*****n
发帖数: 5488
3
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.

h****p
发帖数: 87
4
mark
1 (共1页)
进入JobHunting版参与讨论
相关主题
Riverbed 面经问一个关于stringstream的诡异问题
c/c++ qsort/sort 来 sort array of stringlinkedin今天的电面题
收集了几个 List相关的题how to sort strings if alpha order is changed
求助一面试题回馈版面:Google Intern Interview
请教一个phone interview 问题一道caeerCup上的难算法题
问一个 String array sorting 的题。菜鸟请教电面写code,能用哪些function,在线等
linked list排序的算法除了bubble问一个Pinterest的题目
Ask a google interview question(3)问个google老题的最佳解法
相关话题的讨论汇总
话题: tire话题: strings话题: prefix话题: insert话题: stream