Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Alice is freelancing for an online company. for each day i she works, she earns vi>=0 dollars. However, she can program for at most 4

Alice is freelancing for an online company. for each day i she works, she earns vi>=0 dollars. However, she can program for at most 4 consecutive days, but then she must take a day of rest. Given the payoffs v1, v2,..., vn for each day, Alice must decide which days to work and which days to take rest, so as to maximize her total payout at the end of n days, and not work more than 4 days in a row.

(a) Give an example with n = 6 for which the optimal schedule has Alice rest on the first day.

(b) Give an example with n = 10 where the optimal schedule has Alice rest on two consecutive days.

(c) Construct a O(n) dynamic programming solution which computes the optimal schedule and the total amount of money Alice will make without her having to work more than 4 days in a row. You should specify: (1) the recursive problem specification, (2) the base case, and (3) the order in which the subproblems are comuted. Reason why the method is O(n).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago