An n log n Algorithm to Distribute n Records Optimally in a Sequential Access File

Imagine an operating system whose daily operation includes accessing various files of a library F, one at a time. Let us assume that the cost of accessing a file is a function only of the location of that file and the location of the file previously accessed. That is, associated with the set L of locations, we have a cost matrix C with cij representing the cost of accessing the file at location j immediately after visiting location i.