Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. (30 pts) The cashier's (greedy) algorithm for making change doesn't handle arbitrary denominations optimally. In this problem you'll develop a dynamic programming solu tion

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

3. (30 pts) The cashier's (greedy) algorithm for making change doesn't handle arbitrary denominations optimally. In this problem you'll develop a dynamic programming solu tion which does, but with a slight twist. Suppose we have at our disposal an arbitrary number of cursed coins of each denomination d, d2,... ,dk, with d > d2 > > dk, and we need to provide n cents in change. We will always have dk - 1, so that we are assured we can make change for any value of n. The curse on the coins is that in any one exchange between people, with the exception of i -k- 1, if coins of denominatiorn d, are used, then coins of denomination di+1 cannot be used. Our goal is to make change using the minimal number of these cursed coins (in a single exchange, i.e., the curse applies) (a) (10 points) For i E {1, k), n E N. and b {0.1), let C(i, n, b) denote the number of cursed coins needed to make n cents in change using only the last i denominations dk-i+1, dk-i+2,...,d only if i d2 > > dk, and we need to provide n cents in change. We will always have dk - 1, so that we are assured we can make change for any value of n. The curse on the coins is that in any one exchange between people, with the exception of i -k- 1, if coins of denominatiorn d, are used, then coins of denomination di+1 cannot be used. Our goal is to make change using the minimal number of these cursed coins (in a single exchange, i.e., the curse applies) (a) (10 points) For i E {1, k), n E N. and b {0.1), let C(i, n, b) denote the number of cursed coins needed to make n cents in change using only the last i denominations dk-i+1, dk-i+2,...,d only if i

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

Modern Datalog Engines In Databases

Authors: Bas Ketsman ,Paraschos Koutris

1st Edition

1638280428, 978-1638280422

More Books

Students also viewed these Databases questions

Question

Explain the steps involved in training programmes.

Answered: 1 week ago

Question

What are the need and importance of training ?

Answered: 1 week ago

Question

What is job rotation ?

Answered: 1 week ago

Question

8-6 Who poses the biggest security threat: insiders or outsiders?

Answered: 1 week ago