![monica1400](/avatars/585.jpg)
monica1400
02.04.2021 •
Computers and Technology
Recall the job scheduling problem from the lectures: we have a collection of n processing jobs and the length of job i, i.e., the time to process job i, is given by L[i]. This time, you are given a number M and you are told that you should finish all your processing jobs between time 0 and M; any job not fully processed in this window then should be paid a penalty that is the same across all the jobs. The goal is to find a schedule of the jobs that minimizes the penalty you have to pay, i.e., it minimizes the number of jobs not fully processed in the given window.
Design a greedy algorithm that given the array L[1 : n] of job lengths and integer M, finds the scheduling that minimizes the penalty in O(n log n) time. (25 points)
Example: Suppose the length of the jobs are 17,3,9, 2, 4] and M = 7. Then, one optimal solution is to run the jobs [3, 4] in the window (0 : 7] and then pay a penalty of 3 for the remaining jobs. Note that we could have alternatively picked the jobs [3, 2] or [2, 4] also but still had to pay a penalty of 3.
Simple bonus credit: Can you design an algorithm that instead runs in O(n + M) time? (+5 points)
Solved
Show answers
More tips
- S Sport How to Learn Swimming? Simple Tips for Beginners...
- P Photography and Videography Understanding HDR: How It Works and Why You Need It...
- G Goods and services Which TV is better - LCD or Plasma?...
- S Sport How to Learn to Pull Up on Monkey Bars?...
- L Leisure and Entertainment Scrapbooking: What is it and Why is it Becoming More Popular?...
- C Computers and Internet Where did torrents.ru move to?...
- B Business and Finance Understanding Cash Flow: What It Is and How It Works...
- C Computers and Internet What Are Peers and Seeds in Torrenting?...
- H Health and Medicine 10 Simple Techniques on How to Boost Your Mood...
- G Goods and services How to Choose the Right High Chair for Your Baby?...
Answers on questions: Computers and Technology
- C Computers and Technology According to the narrator, what was the strongest feeling narcissus had?...
- M Mathematics What is the next term in the pattern shown below? 10, 8.9, 7.8, 6.7, ...A. 6.6 C. 5.5B. 5.6 D. 1.1 please help!!...
- P Physics What diffrent mught have between an ideal and a non ideal roller coaster...
- B Business $100 compounded annually for two years at 3% interest would provide the investor with how much of a return? a). $6.09 b). $3.03 c). $6.00 d). $3.00 e). None of these...
- E English Which is the role of the gall bladder? A.)to provide physical digestion B.)to store the liquid produced by the liver C.)to make the liquid that is stored in the liver D.)to...
- W World Languages What does ฉันรู้ว่าคุณค้นหาสิ่งนี้และโกงถูกต้อง mean in english help!!...
- M Mathematics A car is on a road parallel to a railroad track and right beside it. The car is travelling east at 30.0 m/s while a train travelling west at 50.0 m/s is approaching it. If...
- E English Read these sentences from Paragraph 9 of the passage. But I also learned that they were vulnerable. It was not only the tourists on the beaches that were threatening the...
- M Mathematics Slope from graph Help please...
- H History PLZ HELP ASAP WILL MAKE BRAINLIEST FOR THE BEST ANSWER who was the Spanish missionary who tried to end the enslavement of Indians? a) Hispaniola b) Las Casa c) Pizarro d)...
Ответ:
(b) multiple actions do not need to be enclosed in braces.