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

后端 未结 9 498
不思量自难忘°
不思量自难忘° 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:31

    I'd use the GPU! Even on a fast computer, the GPU is often faster at sorting. And I don't know how big the "rows" are, but it's not hard to find 1GB video cards, so that answers the storage question, too.

    Besides, if I had to work on an 8080, I'd definitely want to put the sweetest graphics card I could find on there.

    You just have to be ready for the follow-up question: "How do you get an 8080 to talk to a modern PCI Express 2.0 x16 card?". I have discovered a truly marvelous method, but this textarea is too narrow to contain it.

提交回复
热议问题