Question: Dynamic Programming ] In this exercise, we will count the number of ways to make change for c cents ( for an illustration, watch the

Dynamic Programming]
In this exercise, we will count the number of ways to make change for c cents (for an illustration,
watch the SpongeBob SquarePants episode Squids Day Off from 4:25 to 4:45)
In the problem, coins are available in k denominations $0.01= d0< d1<< dk1, with at
least c coins of each denomination available.
The problem comes down to a choice: given an amount and a coin j with value dj, count
the number of ways to make cents with coin j and count the ways to make cents without
coin j and add the ways. Of course, if dj >, then the coin cannot be included.
a. There are two base cases for the recursive function. Explain the purpose of each.
b. Given the base cases and the include-dont include approach, derive a recursive func-
tion to compute the number of ways to make c cents.
c. Given coins in denominations $0.01, $0.02, $0.03 and $0.05, show the completed ta-
ble used in a dynamic program to count the number of ways to make $0.11.
3 of 7

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!