13.1
Consider the deletion of record 5 from the file of Figure 13.3. Compare the relative merits of the following techniques for implementing the deletion:
Move record 6 to the space occupied by record 5, and move record 7 to the space occupied by record 6.
Move record 7 to the space occupied by record 5.
Mark record 5 as deleted, and move no records.
Although moving record 6 to the space for 5 and moving record 7 to the space for 6 is the most straightforward approach, it requires moving the most records and involves the most accesses.
Moving record 7 to the space for 5 moves fewer records (than option a) but destroys any ordering in the file.
Marking the space for 5 as deleted preserves ordering and moves no records, but it requires additional overhead to keep track of all of the free space in the file. This method may lead to too many “holes” in the file, which if not compacted from time to time, will affect performance because of the reduced availability of contiguous free records.