Question: a) Write a program that prompts the user to input the prices for rod lengths from 1 to 10. b) Prompt the user for

a) Write a program that prompts the user to input the prices for rod lengths from 1 to 10. b) Prompt the user 

a) Write a program that prompts the user to input the prices for rod lengths from 1 to 10. b) Prompt the user for an input rod length (it must be between 1 and 10). Let's call this variable n. c) Output the maximum revenue for a rod of length n (i.e. r). d) Output the cuts the yield the maximum revenue. Example: inputs: prices: [1, 5, 8, 9, 10, 17, 17, 20, 24, 30] n: 7 output: maximum revenue 18. rod cuts 1, 6 Important: a) You must use bottom-up dynamic programming (i.e. no recursion). b) In class, we wrote code to compute the "r" and "s" arrays, but we did not write code to use the "s" array to cut the rod. I'd like to see how you write this code (Hint: It's very simple).

Step by Step Solution

3.29 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Solution Sure here is a Python program that solves the rod cutting problem using bottomup dynamic programming def rodcuttingprices n Solves the rod cu... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!