File Systems

Answer & solution
Official answer: 153
For contiguous allocation, shift original blocks 51 through 100 one position to the right, working backward. Each of the 50 blocks is read and written, costing 100 disk accesses; writing the new memory-resident block costs one more, so nA=101. For linked allocation, follow the chain by reading blocks 1 through 50, costing 50 reads. Retain block 50 and its old next pointer in memory, write the new block pointing to original block 51, and rewrite block 50 to point to the new block: two writes, so nB=52. The sum is 153. This is the usual uncached data-block I/O model, with file-control blocks already in memory and no extra metadata-flush charges.
The backward shift in A is essential: forward shifting would overwrite block 52 before reading its original contents. In B, the data of blocks 51…100 stay in place; only the predecessor’s link and new block are written. Traversing 50 blocks rather than reading all 100 is sufficient to locate the insertion point.