External sort

From Rosetta Code
Revision as of 17:19, 5 October 2016 by Proton (talk | contribs) (Created the external sort task)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
External sort is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Sort a huge file too large to fit into memory. The algorithm consists in reading a large file to be sorted in chunks of data small enough to fit in main memory, sort each of the chunks, write them out to a temporary file, and finally combined the smaller subfiles into a single larger file. For more info see: https://en.wikipedia.org/wiki/External_sorting

The sorting algorithm can be any popular sort, like quicksort. For simplicity one can assume that the file consists of fixed lenght integers and that the sort function is less-than (<).