How to sort 100GB worth of strings

前端 未结 7 829
情歌与酒
情歌与酒 2020-12-12 11:45

Given a harddrive with 120GB, 100 of which are filled with the strings of length 256 and 2 GB Ram how do I sort those strings in Java most efficiently? How long will it take

7条回答
  •  粉色の甜心
    2020-12-12 12:11

    You should use a trie (aka: a prefix tree): to build a tree-like structure that allows you to easily walk through your strings in an ordered manner by comparing their prefixes. In fact, you don't need to store it in memory. You can build the trie as a tree of directories on your file system (obviously, not the one which the data is coming from).

提交回复
热议问题