Question
1. Coin row revisited: Design a dynamic programming algorithm for the coin row problem but change the constraint to be: You may not pick up
1. Coin row revisited: Design a dynamic programming algorithm for the coin row problem but change the constraint to be: You may not pick up a new coin until you have passed up at least two coins rather than one coin as in the problem discussed in the screencast. Thus, you goal is pick up the maximum amount of money picking up coins leaving at least two coins between each picked up coin. Example: 1 2 3 4 5 6 7 8 9 10 11 12 1 2 10 5 2 3 11 1 1 1 1 13 -- the answer would be to pick up coins 3(10), 7(11), 12(13) for a total of 34. A. Specify the function that represents the quantity to be optimized. In this case let maxVal (args) represent the maximum value of a feasible solution of picking up the coins in a the coin row. B. Give the recurrence relation that describes the optimal substructure of the problem using maxVal (args). Dont forget to specify the base case(s). C. Give the specification of the table that you would use in a bottom up programmatic solution. Specify the dimensions of the table and what each entry in the table represents. D. Write the pseudo code of the algorithm for filling in the table that you would use in a bottom up programmatic solution. That is convert the recurrence relation (part B.) to an iterative algorithm. E. Write the pseudo code of the algorithm for tracing back through the table to find the set of compatible tasks that gives the maximum total value. F. Write the asymptotic complexity of filling in the table.
Step 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