Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

#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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions