Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. (15 marks) Suppose that n files with lengths L1, L2, ... Ln are to be stored on a ... tape, so

  

3. (15 marks) Suppose that n files with lengths L1, L2, ... " Ln are to be stored on a ... " tape, so that access to them is sequential. If the files are stored in the order i, in, then the time to retrieve file ik is the sum of the file lengths of all files before and including ik: k Tk = Lij Lij j=1 (1) We would like to order the files to minimize the average retrieval time, so we want to minimize n Ik n k=1 (2) (a) Design and write a greedy algorithm that will find the minimum average retrieval time for the files. (b) Analyse your algorithm's running time. (c) Prove that your algorithm works correctly.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

a Greedy Algorithm 1 Sort the files in nondecreasing order of length 2 Calculate the total retrieval time as follows Initialize total time T to 0 For ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Math

Authors: Cheryl Cleaves, Margie Hobbs, Jeffrey Noble

10th edition

133011208, 978-0321924308, 321924304, 978-0133011203

More Books

Students also viewed these Programming questions