Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
#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
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