Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Dynamic Programming 2. (8 pts) Assume that you have a list of n home maintenance/repair tasks (numbered from 1 to n) that must be done
Dynamic Programming
2. (8 pts) Assume that you have a list of n home maintenance/repair tasks (numbered from 1 to n) that must be done in list order on your house. You can either do each task i yourself at a positive cost (that includes your time and effort) of cli]. Alternatively, you could hire a handyman who will do the next 4 tasks on your list for the fixed cost h (regardless of how much time and effort those 4 tasks would cost you). You are to create a dynamic programming algorithm that finds a minimum cost way of completing the tasks. The inputs to the problem are h and the array of costs c[1], . . . , c[n] (3 pts) First, find a justify a recurrence (with boundary conditions) giving the optimal cost for completing the tasks. .(1 pts) Give an O(n)-time recursive algorithm with memoization for calculating the value of the recurrence. (1 pt) Give an O(n)-time bottom-up algorithm for filling in the array (2 pts) Describe how to determine which tasks to do yourself, and which tasks to hire the handy- man for in an optimal solution. 2. (8 pts) Assume that you have a list of n home maintenance/repair tasks (numbered from 1 to n) that must be done in list order on your house. You can either do each task i yourself at a positive cost (that includes your time and effort) of cli]. Alternatively, you could hire a handyman who will do the next 4 tasks on your list for the fixed cost h (regardless of how much time and effort those 4 tasks would cost you). You are to create a dynamic programming algorithm that finds a minimum cost way of completing the tasks. The inputs to the problem are h and the array of costs c[1], . . . , c[n] (3 pts) First, find a justify a recurrence (with boundary conditions) giving the optimal cost for completing the tasks. .(1 pts) Give an O(n)-time recursive algorithm with memoization for calculating the value of the recurrence. (1 pt) Give an O(n)-time bottom-up algorithm for filling in the array (2 pts) Describe how to determine which tasks to do yourself, and which tasks to hire the handy- man for in an optimal solutionStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started