I know this has 5 problems, but they are ALL related. I also set the point value at the max 1500 (300 pts. per problem). They should be super easy for an expert.
Consider a rod-cutting problem for a rod of length 5, with the following table of lengths and prices:
length price
1 2
2 6
3 7
4 10
5 12
Suppose you write a function manual(n) which returns the maximum value that can be obtained from a rod of length n.
1. Write (neatly please!) a few lines of C code to recursively calculate the value of manual(n).
2. Draw the call tree for the evaluation of manual(5) based on your function definition above.
3. How many calls are made to the manual(n) function?
4. Show how to calculate the solution to this problem working from the smaller case (manual(1)) up to manual(5) and utilizing a memory of already-calculated values.
5. What is the maximum possible value you can get by cutting this rod?