Question: This code prints out the Max Profit when cutting a rod but i also need it to print out the length that produced the maximum

This code prints out the Max Profit when cutting a rod

but i also need it to print out the length that produced

the maximum profit, Thanks.

Example: Rod Length: 4

Prices: 1, 5, 8, 9

Max Profit: 10 with lengths 2, 2

This code prints out the Max Profit when cutting a rod but

#includeiostream> #includeCLimits 3 4 using namespace std; 6 int max (int a, int b) f return (a > b)? a : b;]h 7 Vold rodCuttingtint n, int value!?) int i,j; int result [n+1]; result[0]-0; 10 12 13 for(i-l;i>value[i]; rodCutting (n,value); return 0

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!