Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please write a working program using Java or C programming language. (Submit through Canvas) Due: March 27th, 2018: 1 PM In this quiz, you will

image text in transcribed

please write a working program using Java or C programming language.

(Submit through Canvas) Due: March 27th, 2018: 1 PM In this quiz, you will implement the greedy algorithm discussed in class to determine an optimal allocation of files in a tape to minimize the average cost to access the files You would generate an array of N' files such that the maxinum size of any file is M' and the maximum frequency of access for any file is P. You will get the inputs for these three values from the user. The actual size for any file would be a randomly generated integer in the range [I...MI) and the actual frequency of access for any file is also a randomly generated integer in the range [. .F]. You need to order the files in the increasing order of () File Index, (ii) File Size and (ii) Size/ Frequency ratio and determine the average costs to access any file for each of these strategies (as is done in the examples in the slides). You need to use an appropriate sorting algorithm that would facilitate sorting the dataset based on one of the three measures (file index, file size or size/frequency ratio) at any time. Break any tie in the ordering of the files (when ordered based on file size or size/frequency ratio) using the file index. Input Values to Usc Student Name Leon Anderson10 25 50 Uiwal Baskota Student Name Yoseph H 10 25 75 15 25 75 20 25 75 25 25 75 30 25 75 10 75 25 15 75 25 20 75 25 25 7525 15 25 50 Antonie Hobson Albert Boateng20 25 50 Portia Junius Nissi Campbell25 25 50 Justin McGuffee Samuel A. Dagne 30 25 James Daniel1050 25 Keara Rogers 50 Ryun Moore 15 50 25 Timothy Stewart 20 50 25 Nebiyou Tadesse Zakeia Davis Justin Epps manuel E.Gebre 25 50 25 Phat Tran Mel Groom 30 50 25 Your code should output the following (a) The average costs to access the files when ordered based on (O File Index. (i) File Size and (Gii) Size/Frequency ratio. (b) The ordering of the files (i.e., print the file index values) based oe the allocation strategy (among the three strategies listed above) that results in the lowest average cost to access the files

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

2. What potential barriers would you encourage Samuel to avoid?

Answered: 1 week ago