subject

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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:40
Hello my name is mihai and i need your : )i have to do a python project in computer science and i’m really busy with my mocks this period of time besides this i’m not good at coding so could someone pls pls pls sort me out ? i actually beg ; ))
Answers: 1
question
Computers and Technology, 22.06.2019 13:00
Which part of the cpu accepts data?
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
All of the following are characteristics that must be contained in any knowledge representation scheme except
Answers: 3
question
Computers and Technology, 23.06.2019 07:00
Why were most movies from the late 1890s until the early 1930s only filmed in black and white? there were only a few people who could afford the technology to produce color motion pictures back then. audiences did not want color motion pictures until later. the film used to make color motion pictures often overheated, which was a safety hazard, so it was generally not allowed. color films had to be hand-colored, frame by frame.
Answers: 3
You know the right answer?
Himanshi has overloaded on classes this semester to the point where it’s Friday and she realizes tha...
Questions
question
English, 30.04.2021 20:20
question
Mathematics, 30.04.2021 20:20
question
Mathematics, 30.04.2021 20:20
question
Mathematics, 30.04.2021 20:20
question
Mathematics, 30.04.2021 20:20
Questions on the website: 13722363