Question: You are given a set S = { a 1 , a 2 , . . . , an } of tasks, where task ai
You are given a set S a a an of tasks, where task ai requires pi units of processing time to complete, once it has started. You have one computer on which to run these tasks, and the computer can run only one task at a time. Let ci be the completion time of task ai that is the time at which task ai completes processing. Your goal is to minimize the average completion time, that is to minimize n Pn i ci For example, suppose there are two tasks, a and a with p and p and consider the schedule in which a runs first, followed by a Then c c and the average completion time is If task a runs first, however, then c c and the average completion time is Give a greedy algorithm that schedules the tasks so as to minimize the average completion time. Each task must run nonpreemptively, that is once task ai starts, it must run continuously for pi units of time. Prove that your algorithm minimizes the average completion time. One of the two following problems can be solved using a greedy algorithm, the other cannot. Recall that greedy algorithms are faster than dynamic programming algorithms, so you should always try to solve with a greedy algorithm when possible.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
