Suppose there are six files F1, F2, F3, F4, F5, F6 with corresponding sizes 150 KB, 225 KB, 75 KB, 60 KB, 275 KB and 65 KB respectively. The files are to be stored on a sequential device in such a way that optimizes access time. In what order should the files be stored?

This question was previously asked in
UGC NET Computer Science (Paper 2) Nov 2017 Official Paper
View all UGC NET Papers >
  1. F5, F2, F1, F3, F6, F4
  2. F4, F6, F3, F1, F2, F5
  3. F1, F2, F3, F4, F5, F6
  4. F6, F5, F4, F3, F2, F1

Answer (Detailed Solution Below)

Option 2 : F4, F6, F3, F1, F2, F5
Free
UGC NET Paper 1: Held on 21st August 2024 Shift 1
10.9 K Users
50 Questions 100 Marks 60 Mins

Detailed Solution

Download Solution PDF

The correct answer is option 2.

Key Points

Six files are stored in a sequential device. It is like an optimal merge pattern. To get optimum access time, first, sort all the files according to their sizes. For sorting it will take worst case O(N log N) but will give the optimal result. Select the two files which are minimal in size.

Merging files required m + n - 1 comparisons.

Merge

F1 Raju Shraddha 07.04.2020 D14 1

Total number of comparisons 125 + 200 + 300 + 400 + 500 = 1525 and the order is F4, F6, F3, F1, F2, F5.

∴ Hence the correct answer is F4, F6, F3, F1, F2, F5.

Shortcut Trick

Sort the files based on size in ascending order

Latest UGC NET Updates

Last updated on Jun 12, 2025

-> The UGC NET June 2025 exam will be conducted from 25th to 29th June 2025.

-> The UGC-NET exam takes place for 85 subjects, to determine the eligibility for 'Junior Research Fellowship’ and ‘Assistant Professor’ posts, as well as for PhD. admissions.

-> The exam is conducted bi-annually - in June and December cycles.

-> The exam comprises two papers - Paper I and Paper II. Paper I consists of 50 questions and Paper II consists of 100 questions. 

-> The candidates who are preparing for the exam can check the UGC NET Previous Year Papers and UGC NET Test Series to boost their preparations.

More Greedy Algorithms Questions

More Algorithm Design Techniques Questions

Get Free Access Now
Hot Links: teen patti club teen patti master game teen patti apk