The multimedia/mobile company you work for is currently attempting to transfer large media files from older disks to newer disks (on various servers). The task of simply copying over all of these files in any haphazard order is fairly straightforward; however, you believe that you can improve upon a haphazard approach and hope to improve the efficiency of storage space on the new disks. You have a collection of m disks, but you believe that if you smartly organize the media files onto the disks, you may not need to use all m disks.
You plan to design a greedy algorithm to efficiently transfer media to storage devices. Note that this is an optimization problem. Optimization problems have a general structure and consist of some quantity to be maximized or minimized under some list of constraints. In this problem, you have n files (f1, …, fn) with corresponding sizes (in MBs) s1, … sn. Your goal is to store these files onto m disks, d1, …, dm, that have corresponding storages amounts t1, …, tm. Note that one file cannot be spread across multiple disks. In this problem, the goal is to minimize the amount of storage that is not used on each disk (that is used). This should also minimize the total number of number of disks being used. That is, you would like to fill up each disk as much as possible while leaving a minimally small amount of unused storage. (In the perfect case, each disk would be perfectly filled, and there would be no unused storage.) If there are any disks left unused, you will be able to return them for a refund.
Design a greedy algorithm using pseudocode that solves this optimization problem of transferring files to disk while minimizing unused storage. The inputs to this algorithm are the number of files n, corresponding sizes (in MBs) s1, … sn, m the number of disks, and corresponding storages amounts t1, …, tm. The algorithm should return an array map[i] which contains the disk index of which the ith media file should be stored.
Comment your pseudocode for increased readability.
Discuss the optimality of your algorithm. Is it guaranteed to return an optimal result?
What is the Big-O time complexity of this algorithm in terms of m and n? Justify your answer.
If you were to solve this problem using a brute force or exhaustive search method, what would be the time complexity? Justify your response.
All papers are written by ENL (US, UK, AUSTRALIA) writers with vast experience in the field. We perform a quality assessment on all orders before submitting them.
We provide plagiarism reports for all our custom written papers. All papers are written from scratch.
Contact us anytime, any day, via any means if you need any help. You can use the Live Chat, email, or our provided phone number anytime.
Get your money back if your paper is not delivered on time or if your instructions are not followed.