### Question

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.

### Solution

There’re enough discussion on **Top K problems** so far in this blog. The suggest solutions is:

Sort

Min Heap, O(n logm) time.

Quickselect algorithm. O(n) time.