- Exercise 17.3-1, page 344.

- Exercise 17.3-6, page 344.
*NB:*make sure your algorithm works even when the number of characters is even. - Consider the following scheduling problem to minimize the average time
a job spends in a system. For this problem, we have a single server and
n jobs which take processing time t
_{1}, ..., t_{n}. The server can process the jobs in any order, but once a job has started, the server must process the job until completion. All the jobs are submitted at time 0. The time that job i spends in the system is the sum of the time job i spends waiting while the processor is executing other jobs and t_{i}.For example, suppose that n=3, t

_{1}= 7, t_{2}= 12, t_{3}= 4, and the processor executes the jobs in the order 2 1 3. Then the average waiting time is:(12 + (12 + 7) + (12 + 7 + 4))/3 = 54/3 = 18.

A better order would be 1 3 2 (with an average time of 13.666), but even this is not optimal.Devise a greedy algorithm to find the optimum ordering for this scheduling problem

*and prove that your algorithm produces the optimum ordering*. State and briefly justify the running time of your algorithm.

Last Modified: 29 Jan 2001 13:00:53 EST by

Richard Chang

Back up to Spring 2001 CMSC 641 Homepage