in Databases edited by
7,960 views
7 votes
7 votes

Six files $\text{F1, F2, F3, F4, F5}$ and $\text{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. $\text{F3, F4, F1, F5, F6, F2}$
  2. $\text{F2, F6, F5, F1, F4, F3}$
  3. $\text{F1, F2, F3, F4, F5, F6}$
  4. Ordering is immaterial as all files are accessed with the same frequency.
in Databases edited by
by
8.0k views

2 Comments

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

7 Answers

14 votes
14 votes
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

2 Comments

why ?

how  cost to access file will be minimum?
0
0
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.
4
4
0 votes
0 votes
Using optimal merge pattern
Option A.
0 votes
0 votes
I think Option A

Since each file is accessible with same frequency.
0 votes
0 votes
F1,F2,F3,F4,F5,F6
Answer:

Related questions