一道巨常见的题# JobHunting - 待字闺中
j*2
1 楼
Write a function that gets a billion integers. How can you find the median
in most efficient way (time)?
Follow-up: If the input is an endless stream of integers, and we want to
find the current median.
第一个是不是用partition based selection, expected time O(n)
第二个用min and max heaps, expected time O(nlogn)
困惑的是:一个函数装得下a billion integers吗?要不要分几个phase啥的?
in most efficient way (time)?
Follow-up: If the input is an endless stream of integers, and we want to
find the current median.
第一个是不是用partition based selection, expected time O(n)
第二个用min and max heaps, expected time O(nlogn)
困惑的是:一个函数装得下a billion integers吗?要不要分几个phase啥的?