Template Function ADS::multiwayMergeSort

Function Documentation

template<class T, class C = std::less<>, class Sel = LoserTree<T, C>>
void ADS::multiwayMergeSort(const DiskFile<T> &in, DiskFile<T> &out, C less = C(), bool snowPlow = false)

the items of in, sorted, into out, by the mergesort of fan-in M / B - 1; the runs by replacement selection if snowPlow; the least of the heads of the runs chosen by a Sel, the tree of losers of the notes by default [see LoserTree.h for its interface]

Pre:

M >= 3 B, out empty, the two files on the same memory

Post:

out sorted, with the items of in (an audit)