How to sort millions of rows of data in a file with less/meagre memory

后端 未结 9 510
不思量自难忘°
不思量自难忘° 2021-02-01 06:44

(From here)

I attended an interview last week and this question was asked:

How do you sort a billion rows of data in a file with only 640KB of memory in

9条回答
  •  走了就别回头了
    2021-02-01 07:39

    Heapsort would be my reccomendation. It's relatively quick when n is large, and you only have to look at three elements with definite indecies at once.

    That being said, my intuition tells me that sorting a billion rows on an 8080 even in C would be unfeasibly slow.

提交回复
热议问题