24.8 Case Study: File Merge Sort (cont.)

Phase II

  1. Remove 2 files from queue, open them
  2. Merge contents (can be done holding a few elements in memory), writing to new temporary file
  3. Delete 2 old files
  4. Make another pass over input, removing duplicates
  5. Add new file to end of queue
  6. If there's more than 1 file on the queue, goto 1
  7. Copy final file to stdout

prev |top |next