Question: Write a functional C++ program to display the following output: Given a rod of length n inches and a table of prices p i for

Write a functional C++ program to display the following output:

Given a rod of length n inches and a table of prices pi for i = 1, 2, ...,n, determine the maximum revenue rn obtainable by cutting up the rod and selling the pieces. Note that if the price pn for a rod of length n is large enough, an optimal solution may require no cutting at all.

Your program must output the running time for rod-lengths of 1 to 30.

Include the running-time behavior, expressed as Big-O.

Requirements:

1.) C++ code that displays the optimal revenue for lengths (n) 1 to 30

2.) For each length, the code must display the run-time for the algorithm (note: I am not interested in run-time for the entire program, only the cut-rod algorithm). Your output should be a table with n, optimal revenue, run-time.

3.) An expression of the behavior in terms of Big-O. PROVIDE PROOF/EXPLANATION

p[11] to p[40] = 30

REQUIRED OUTPUT FORMAT:

Write a functional C++ program to display the following output: Given a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!