Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Making Change Imagine you live in a country where the coin denominations are 1 cent, 4 cents, and 5 cents. Consider the problem where

image text in transcribed

3. Making Change Imagine you live in a country where the coin denominations are 1 cent, 4 cents, and 5 cents. Consider the problem where you are given some value n and you want to make change for this value, using the smallest number of coins. Part 1: Show that the greedy algorithm (use the largest value coins first) for making change fails for these denominations Part 2: Describe a dynamic programming algorithm for finding the smallest number of coins needed in this country to make change for any value of n. Analyze your algorithm. Part 3: Provide the running time of your algorithm

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

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

=+ how might this lead to faster growth in productivity?

Answered: 1 week ago