0

I have a 1GB file with random words with length 1 to 256 and I have just 2GB RAM for sorting that(if ram usage goes above 2GB the process will be killed).

What's the most efficient way to sort the words in the file in lexicographical order with C++ or java?

For example, is there a better way than a trie tree or a way to implement it more efficiently?

  • Related: [Sort a file with huge volume of data given memory constraint](https://stackoverflow.com/questions/2087469/sort-a-file-with-huge-volume-of-data-given-memory-constraint) (although it's different since the file can't fit into memory in that case) – Bernhard Barker Oct 31 '18 at 12:49
  • Do you get to use any additional disk space? What makes you think that a trie would be an efficient way to sort? – Jim Mischel Oct 31 '18 at 13:49

0 Answers0