1.Design a dynamic programming algorithm for the following problem. Find the maximum total sale price that can be obtained by cutting a rod of n units long into integer-length pieces if the sale price of a piece i units long is pi for i = 1, 2, ..., n
2.Write a dynamic programming algorithm that computes the minimum number of coins required to produce an amount v.
You are given n coins of integer denomination d1 < d2 < d3 < ...< dn. Write the base case, recurrence and the pseudo code. Also take an example and show the table that is computed.
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
1. We built the Dynamic Programming algorithm in steps; we are interested in computing only the maximum achievable price and not also in retaining the optimal cuts along the rod.
1st DP step). - Optimal arrangement of the cuts for the n-units length rod is obtained progressively at each step. An immediate conclusion is that if it is decided a cut of length i, then also the reminder of n-i units length must be optimal because otherwise when we compute the sum of the prices the result would not be the best (assuming one of the cuts is not optimal at a random step)....
This is only a preview of the solution. Please use the purchase button to see the entire solution