Describe an algorithm to find the largest 1 million numbers in 1 billion numbers.
Assume that the computer memory can hold all one billion numbers.
There’re enough discussion on Top K problems so far in this blog. The suggest solutions is:
Min Heap, O(n logm) time.
Quickselect algorithm. O(n) time.