由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - M家问题
相关主题
请教一道题Second round phone interview with eBay
面试题求解:remove first duplicate number from an arrayAmazon onsite 面经
re: 面试归来,上面经回馈各位战友分享面试题
请教一题A公司面挂了,发面经,攒RP
一道算法题subset
amazon二面弱弱的问问intersection, union of two arrays or two sets ?
问个amazon面试题急只有几个小时时间, 如何快速复习基本数据结构和算法
弱问一道G家电面题请教一道题
相关话题的讨论汇总
话题: merge话题: remove话题: string话题: duplicates话题: lists
进入JobHunting版参与讨论
1 (共1页)
m********l
发帖数: 4394
1
How do you merge 2 string lists and remove duplicates.
S**N
发帖数: 182
2
merge, and then sort, and then de-dup?

【在 m********l 的大作中提到】
: How do you merge 2 string lists and remove duplicates.
l*****a
发帖数: 14598
3
no need to be sorted
just merge,not need to in order,right?

【在 S**N 的大作中提到】
: merge, and then sort, and then de-dup?
y*******g
发帖数: 6599
4
不sort不要de dup
除非加一个hashtable

【在 l*****a 的大作中提到】
: no need to be sorted
: just merge,not need to in order,right?

n*******w
发帖数: 687
5
sort的代价有点大,O(nlgn )。
比较常规考虑,hashmap其中小的那个string list并且remove dups。然后把大的merge
进来。
如果考虑到hashmap可能overflow,换ties。还不够的话,先用hash function把
string list split到小文件上,然后再用hashmap来remove dups。最后直接合并成大
文件。
进一步,如果容许小概率出错,可以上bloom filter。

【在 m********l 的大作中提到】
: How do you merge 2 string lists and remove duplicates.
s********7
发帖数: 4681
6
bless.
g*********s
发帖数: 181
7
直接往HashSet 里放不就行了吗?

【在 m********l 的大作中提到】
: How do you merge 2 string lists and remove duplicates.
1 (共1页)
进入JobHunting版参与讨论
相关主题
请教一道题一道算法题
一道电面题,分享下, 这个题应该用哪几个data structure?amazon二面
大家帮我看看这个程序哪里有问题啊!!问个amazon面试题
有些面试题是够扯蛋的弱问一道G家电面题
请教一道题Second round phone interview with eBay
面试题求解:remove first duplicate number from an arrayAmazon onsite 面经
re: 面试归来,上面经回馈各位战友分享面试题
请教一题A公司面挂了,发面经,攒RP
相关话题的讨论汇总
话题: merge话题: remove话题: string话题: duplicates话题: lists