Finding k-largest elements of a very large file (while k is very LARGE)
问题 Let's assume that we have a very large file which contains billions of integers , and we want to find k largest elements of these values , the tricky part is that k itself is very large too , which means we cannot keep k elements in the memory (for example we have a file with 100 billon elements and we want to find 10 billion largest elements) How can we do this in O(n) ? What I thought : We start reading the file and we check it with another file which keeps the k largest elements (sorted in