Sort a huge array

What is the best way to sort a huge array. I have 1G RAM, a 16G array. What is the most effective method for doing this? I have enough files for files.

+3
source share
2 answers

Divide into pieces and sort 512 MB in 32 files. Then stream stream the files into a single file.

+16
source

If it is an array of integers, you can get a naive sort of radius (O(n))and almost no RAM. First question: "What is the data?" If its arbitrary data, then external merging is likely to be your best option.

-tjw

+4
source

Source: https://habr.com/ru/post/1794310/


All Articles