

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The coin change problem, where given a set of coin types and an amount of change, the goal is to determine the fewest number of coins required. Two approaches are explored: a 'greedy' algorithm using us coin types {1, 5, 10, 25, 50} and a divide-and-conquer algorithm. The document also includes a recursive relationship and a few levels of the recursion tree for 29-cents change.
Typology: Study notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


a) What "greedy" algorithm would you use to solve this problem with US coin types of {1, 5, 10, 25, 50} and a change amount of 29-cents?
b) Do you get the correct solution if you use this algorithm for coin types of {1, 5, 10, 12, 25, 50} and a change amount of 29-cents?
a) For the coin-change problem, what determines the size of the problem?
b) How could we divide the coin-change problem for 29-cents into smaller problems?
c) If we knew the solution to these smaller problems, how would be able to solve the original problem?
29 cents
1-cent coin 5-cent coin 10-cent coin
12-cent coin 25-cent coin^ 50-cent coin Possible First Coin
Original Problem
Smaller problems
coin ∈CoinSet and coin change
29 cents
1-cent coin 5-cent coin 10-cent coin
12-cent coin 25-cent coin^ 50-cent coin Possible First Coin
Original Problem
Smaller problems