Computers and Technology

Himanshi has overloaded on classes this semester to the point where it’s Friday and she realizes that she has homework assignments for all her courses due at different times that same day. Let there be n courses in total, and denote each homework assignment as hi (1 ≤ i ≤ n). Each homework assignment has a deadline di and late penalty pi associated with it. Assume that it takes Himanshi 1 hour for completing each homework assignment, and she can only work on one homework at any given time. If she does not finish homework hi before deadline di then she pays a penalty of pi in that course (no matter when she finishes it past the deadline). Required:
a. Design a greedy algorithm to help Himanshi schedule her homework assignments in a way that minimizes the sum of penalties and analyze the runtime of your algorithm. You can assume the time starts at 0 hours and goes up to n hours, where each time interval is of length 1 hour. Each deadline 1 ≤ di ≤ n and di is an integer. Your algorithm must output a list of n scheduled homework assignments. Example: Let n = 5, and list of homeworks represented as (di , pi) be [(2, 10),(1, 500),(2, 10),(4, 20),(5, 20)] , then one possible optimal solution is h2, h3, h1, h4, h5 which gives a total penalty of 10.

b. Prove the correctness of your algorithm.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 16:30, mesposito
Technician a says that a dry sump system uses no oil storage sump under the engine. technician b says that a wet sump system uses no oil storage sump under the engine. who is correct?
Answers: 3
image
Computers and Technology, 23.06.2019 20:30, batmandillon21
1. for which of the following are you not required to signal beforehand? a. changing lanes b. speeding up c. stopping
Answers: 2
image
Computers and Technology, 24.06.2019 12:30, stephanieanaya7
Why does the pc send out a broadcast arp prior
Answers: 1
image
Computers and Technology, 24.06.2019 15:00, cooljariel11
What questions about an audience should be asked during presentation preparation? check all that apply. what does the audience already know about the topic? how will multimedia tools inspire the audience? is the information interesting and engaging? how will this information affect the presentation? will the audience change the message’s purpose? what is likely to interest the audience?
Answers: 3
Do you know the correct answer?
Himanshi has overloaded on classes this semester to the point where it’s Friday and she realizes tha...

Questions in other subjects: