4.4k views

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

1. F3, F4, F1, F5, F6, F2
2. F2, F6, F5, F1, F4, F3
3. F1, F2, F3, F4, F5, F6
4. Ordering is immaterial as all files are accessed with the same frequency.

edited | 4.4k views
0
what is the meaning of all files are accessed with same frequency?
0
it uses B Tree to insert node...

This is basically optimal storage on tapes problem.Greedy apprach is used to solve this problem.The files are to be stored sequentially  on tape.To read a particular file we need to start from beginning of tape..here goal is to find such order of storage that cost to access file is minimum..in order to achieve the files are stored in increasing order of length

So in above eg files will be stored in order F3 F4 F1 F5 F6 F2
by Boss (31.4k points)
0
why ?

how  cost to access file will be minimum?
+1
If three files os size is like [1000, 30, 2]
To access the file having size 2 in a "tape" which read sequentially like our old audio cassette we need to read "unnecessarily" 1000 and 30 file sized also.

But if arrangement would be [2,30,1000] to read 2 bytes we just access it, no need to wait to skip over 1030 bytes to reach the required file.
Using optimal merge pattern
Option A.
by Boss (16.5k points)
I think Option A

Since each file is accessible with same frequency.
by (179 points)
F1,F2,F3,F4,F5,F6
by (11 points)
Ans.A
by (71 points)
edited
0
For optimization of storage we can arrange the files in ascending order,i.e.,option A
by Loyal (9.9k points)
If random access is considered: Option D

If sequential access is considered: Option A (arranged in increasing order)
by Loyal (6.4k points)