Finding things Quickly VII: KeySorting
Overview: when sorting a file in memory, the only thing that really needs sorting are record keys.
Keysort algorithms work like internal sort, but with 2 important differences:
- Rather than read an entire record into a memory array, we simply read each record into a temporary buffer, extract the key and then discard.
- If we want to write the records in sorted order, we have to read them a second time.