# Two Dynamic Programming Algorithms: Rod Cutting & Minimum Number of Coins Change

Subject Computer Science Data Structures and Algorithms

## Question

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.

## Solution Preview

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

## Related Homework Solutions

MergeSort Algorithm Applied to the E, X, A, M, P, L, E List
\$4.00
Computer Science
Data Structures
Merge-sort
Mergesort
Algorithm
Pseudo
Code
Alphabetical
Order
List
Expression Evaluator in Java
\$70.00
Computer Science
Java Programming
Data
Expressions
Evaluator
Calculator
Operations
Stack
Queue
Packages
Algorithms
Objects
Parameters
Min-Max Heap Operations in C++
\$120.00
Computer Science
C++ Programming
Algorithms
Heap
Linear Time
BinaryHeap
LeftistHeap
Data Structures
Statements
Variables
Algorithm Product First 20 Even Numbers
\$10.00
Big-O
Algorithm
Complexity
Product
Bit
Number
Even
First
Computer
Science
Algorithm That Finds Common Elemens from Two Sorted Lists
\$7.20
Computer
Science
Data
Structures
Algorithm
Sorted
List
Common
Element
Comparisons
Length
Number
Activity Selection Problem in C++ and Java
\$100.00
Computer Science
C++ Programming
Java Programming
Activities
Selections
Algorithms
Lists
Sets
Running Time
Pseudocodes
Live Chats