由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 再问一道题
相关主题
一道巨常见的题median of N^2 numbers across N machines
find medium number in stream 这题怎么作请教一道算法题
A家面试题问道大数据的题
Groupon 電面Groupon电面
要去google onsite的同学们简单map reduce mean median, 傻逼回答
一道大数据题#面试题#有100个database,每个存1 million data,如何求出median number of 这些数。
求教一道面试题[算法] unsorted array
这题应该用bucket sort还是counting sort上一题看看
相关话题的讨论汇总
话题: find话题: bucket话题: file话题: integers话题: sort
进入JobHunting版参与讨论
1 (共1页)
P*******b
发帖数: 1001
1
A huge file contains unsorted integers. Find the median. The file cannot be
loaded in memory
s*********t
发帖数: 1663
2
先外排序,然后再找median

be

【在 P*******b 的大作中提到】
: A huge file contains unsorted integers. Find the median. The file cannot be
: loaded in memory

b********e
发帖数: 693
3
extenal sort by using selection arg?

be

【在 P*******b 的大作中提到】
: A huge file contains unsorted integers. Find the median. The file cannot be
: loaded in memory

h**k
发帖数: 3368
4
如果文件中的整数分布均匀或者值域很小,buckets sort是个好方法。一般来说,只需
要读取文件两次,就可以找到。

be

【在 P*******b 的大作中提到】
: A huge file contains unsorted integers. Find the median. The file cannot be
: loaded in memory

x****k
发帖数: 2932
5
bucket sort to find the bucket holding median number, then generic sort or
heap or bucket sort again.
x*****p
发帖数: 1707
6
1. Find max and min in O(n) time
2. Use binary search to find some x (may not be in the file), such that the
number of integers <= x is the same or 1 difference as the number of
integers >x. It takes O(nlogn) time.
3. Find the closes integer to x in the file. It takes O(n) time.
Totally O(nlogn), and the space required is O(1).
P*******b
发帖数: 1001
7
这样找出来的不一定是median吧,只是个大约比较median的数吧。

the

【在 x*****p 的大作中提到】
: 1. Find max and min in O(n) time
: 2. Use binary search to find some x (may not be in the file), such that the
: number of integers <= x is the same or 1 difference as the number of
: integers >x. It takes O(nlogn) time.
: 3. Find the closes integer to x in the file. It takes O(n) time.
: Totally O(nlogn), and the space required is O(1).

h**6
发帖数: 4160
8
前面 bucket sort 的方法是对的,找出最大最小值,然后根据取值范围分成 256 或者 65536 个 bucket ,统计每个 bucket 内的元素个数,得出中位数再哪个 bucket 里面的第几个。如果该 bucket 内元素个数仍然过多,不能放入内存,那么就继续划分,否则可放入内存排序后得出答案。
1 (共1页)
进入JobHunting版参与讨论
相关主题
上一题看看要去google onsite的同学们
问个google面试题一道大数据题
问道题求教一道面试题
请问两道题这题应该用bucket sort还是counting sort
一道巨常见的题median of N^2 numbers across N machines
find medium number in stream 这题怎么作请教一道算法题
A家面试题问道大数据的题
Groupon 電面Groupon电面
相关话题的讨论汇总
话题: find话题: bucket话题: file话题: integers话题: sort