Question: Pls give a Dynamic Programming algrithm and justify it. 3. (10 marks) With all your school work you're running out of time to complete simple
Pls give a Dynamic Programming algrithm and justify it.

3. (10 marks) With all your school work you're running out of time to complete simple tasks like laundry Since you are a poor student, you realize that if you're going to outsource your laundry there are only two ways you can afford to do this. Either you ask your mom - who immediately tells you to "grow up" or you get together with friends to organize a group laundry service. You poll all your friends to determine who wants in on which weeks and how many loads they each have. From this you have a weekly schedule for n weeks where each value is a number of loads li for week i. You research the two closest laundromats that offer pick-up and delivery. Laundromat L and laundromat L2 have different methods for charging for their services PAGE 1 OF 2 L, charges a fixed rate per load (so it costs rli to pick-up, wash and deliver a week's load l.) L2 makes contracts for a fixed amount w per week, independent of the number of loads. However, contracts with company L2, must be made in blocks of three consecutive weeks at a time. A schedule, for you and your friends laundry, is a choice of laundromat (L or L2) for each of then weeks, with the restriction that laundromat L2, whenever it is chosen, must be chosen for blocks of three contiguous weeks at a time. The cost of the schedule is the total amount paid to laundromat L and L 2, according to the description above. Give a polynomial-time algorithm that (makes you the laundry hero and) takes a sequence of weekly load values 1,22, ..ln and returns a schedule of minimum cost. Explain your algorithm and justify your recurrence relation and complexity. A formal proof is not necessary Example Suppose r 810, w $80, and the sequence of values is 5,8,10,11,9,6,7. Then the optimal schedule would be to choose laundromat Li for the first two weeks, then laundromat 12 for a block of three consecutive weeks and then laundromat L1 for the final two weeks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
