Six files F1, F2, F3, F4, F5 and F6 have 100, 200, 50, 80, 120, 150 records respectively. In what order should they be stored so as to optimize act. Assume each file is accessed with the same frequency
(A) F3, F4, F1, F5, F6, F2
(B) F2, F6, F5, F1, F4, F3
(C) F1, F2, F3, F4, F5, F6
(D) Ordering is immaterial as all files are accessed with the same frequency.
This question is based on the Optimal Storage on Tape problem which uses greedy approach to find the optimal time to retrieve them. There are n programs of length L that are to be stored on a computer tape. Associated with each program i is a length Li. So in order to retrieve these programs most optimally, we need to store them in the non-decreasing order of length Li. So, the correct order is F3, F4, F1, F5, F6, F2
Quiz of this Question
Please comment below if you find anything wrong in the above post
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.