Sorted File

What
A sorted file is one that maintains its pages in a sorted order according to some search key.

Cost of Operations
For the calculations, we will use the following values:
 * B: The number of data pages
 * R: The number of records per page
 * D: (Average) time to read or write disk page

Scan All Records
Scanning all records obviously costs $$BD$$

Equality Search
Equality search on a sorted file takes advantage of the sorted file's eager update. Therefore, we need only apply a binary search on the file to retrieve the matching records. This cost is $$(log_2B)*D$$

Range Search
Range search is very similar to equality search in that we must first find the starting point of the range, then read in all additional qualifying pages sequentially. Therefore, our cost is $$[(log_2B) + \textrm{#match~pg}] * D$$

Insert
Insert for a sorted file is bit more complicated. We must find the place in the file to insert to, then we must unfortunately shift each record in each page over by one to make room. This is using the assumption that the pages are entirely packed. Therefore, the cost is $$((log_2B)+B)D$$ because we must shift on average half of the file. Shifting involves reading and writing. Therefore, the cost is $$0.5B + 0.5B = B$$

Delete
Same cost as insert