10.07.2015 Views

Open-book test #3

Open-book test #3

Open-book test #3

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Problem #2.Given n jobs J 1 , J 2 , ..., J n where each job J i takes T i units of time to complete and has apriority weight W i , you need to schedule the jobs to be done in some order one by one byassigning a starting time S i to each job J i. Time starts from the time point 0 at the timeline. If job J i. starts at time S i , it will be completed at the time S i + T i . No two jobs canoverlap in time and you want to minimize the weighted sum of the completion timeΣ n>= i >=1 W i * (S i + T i )(i) Design an efficient O(n log n) greedy algorithm that can produce a schedule for the njobs and minimize the weighted sum of completion time. Write down the algorithm andprove that the algorithm can always correctly produce a minimal weighted-sum-ofcompletion-timeschedule.(ii) Design an alternative algorithm you can think of. Write down the algorithm and provethat the algorithm can always correctly produce a minimal weighted-sum-of-completiontimeschedule too. What is the time complexity of your alternative algorithm?(iii) Consider the following problem instance. What would be the minimal weighted-sumof-completion-timeschedule generated by your algorithms?Job 1 Job 2 Job 3 Job 4 Job 5W i 4 5 2 3 6T i 6 7 5 6 8

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!