title: How to sort millions of rows of data in a file with less/meagre memory
body: <p>(From <a href="https://stackoverflow.com/questions/134158/how-would-you-sort-1-million-32-bit-integers-in-2mb-of-ram/3961223#3961223">here</a>)</p>
  
  <p>I attended an interview last week and this question was asked:</p>
  
  <p><strong>How do you sort a billion rows of data in a file with only 640KB of memory in a 8080 processor based machine?</strong> No virtual memory, no external disk.</p>
  
  <p>I explicitly asked the interviewer if I could use a hard drive, so I can serialize trees as I sort them and then combine at the end. He said no. I tried many ways, different algorithms. Nothing he agreed.</p>
  
  <p>I gave up and asked him politely, "how would you do that?" He bluntly said, "I would not tell you." (The interview ended right after that. I didn't mean to offend him, as a developer, I got curious. Moreover, it was an instinctive question, just as I would ask anyone at my workplace.)</p>
  
  <p>This interview was for a really big bank.</p>
  
  <p>So, how would anyone approach this problem?</p>