Heap Sorting while Writing to the File
The smallest record in the heap is known during the first step of the sorting algorithm. Therefore, it can be buffered until a whole block is known.
While that block is written onto the disk a new block can be processed and so on.
Since every time a block can be written to disk, the heap size decreases by one block, that block can be used as a buffer. i.e., we can have as many output buffers as there are blocks in the file.
Since all the I/O is sequential, this algorithm works as well with disks and tapes. As well, a minimum amount of seeking is necessary and thus the procedure is efficient.