Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the problem of using the fewest number of coins to make change for an amount of money. Let C1>C2>>Cn=1 be n1 coins of distinct

image text in transcribed
image text in transcribed
Consider the problem of using the fewest number of coins to make change for an amount of money. Let C1>C2>>Cn=1 be n1 coins of distinct integer denominations. (For example, C1=10,C2=5, and C3=1, etc.) Given a certain integer amount S, we would like to use the fewest number of coins to the amount S. For example, if S=18, then given the above 3 types of coins, we need 5 coins (one C1, one C2, and 3C3 ). The answer of the problem is thus 5 for this example. One possible solution of the problem is to solve it recursively. Let N[i][j] be the least number of coins needed to obtain the amount j using coins Ci through Cn (i.e., only coins of types Ci,,Cn are used; coins of types C1,,Ci1 are not used). (a) (i) What is the fewest number of coins needed given C1=10,C2=6,C3=1,S=18 ? (ii) What is N[2][17] given C1=10,C2=6,C3=1 ? (b) Argue that the following recurrence equation is correct: N[i][j]={N[i+1][j],min{N[i+1][j],N[i][jCi]+1},ifCi>j,ifCij. (c) What are the base cases for the above recursive strategy

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions

Question

2. Compare the sales and service departments at Auto World.

Answered: 1 week ago