So-called 'external memory' sorting algorithms generally look very different from in-core algorithms. IIRC, the efficient way involves setting up a 'funnel' of input data streams, and writing out ...