The Gateway to Computer Science Excellence
+6 votes
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.
in Databases by Active (3k points)
edited by | 4.4k views
0
what is the meaning of all files are accessed with same frequency?
0
it uses B Tree to insert node...

7 Answers

+13 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
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.
0 votes
Using optimal merge pattern
Option A.
by Boss (16.5k points)
0 votes
I think Option A

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

If sequential access is considered: Option A (arranged in increasing order)
by Loyal (6.4k points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,297 answers
198,265 comments
104,977 users