for each group of B pages in Rel {
read pages into memory buffers
sort group in memory
write pages out to Temp
}
numberOfRuns = ceil(b/B)
while (numberOfRuns > 1) {
for each group of n runs in Temp {
merge into a single run via input buffers
write run to newTemp via output buffer
}
numberOfRuns = ceil(numberOfRuns/n)
Temp = newTemp
}
|