Cost of External Merge Sort
Cost = 2N * (# of passes)
E.g., with 5 buffer pages, to sort 108 page file:
- Pass 0: = 22 sorted runs of 5 pages each (last run is only 3 pages)
- Pass 1: = 6 sorted runs of 20 pages each (last run is only 8 pages)
- Pass 2: 2 sorted runs, 80 pages and 28 pages
- Pass 3: Sorted file of 108 pages