Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please assist with the problem shown in the given picture: Consider the problem of making change in the amount of n cents using the fewest

Please assist with the problem shown in the given picture:
image text in transcribed
Consider the problem of "making change" in the amount of n cents using the fewest possible number of coins. If the only coins that may be used are quarters (25 cents) , dimes (10 cents), nickels (5 cents) and pennies (1 cent), then the "greedy" algorithm described in class- repeatedly adding to the on of coins comprising the "change" the largest-denomination coin whose value is less than or equal to the amount of change remaining to be made - is guaranteed to achieve an optimal solution (that is, to yield the exact amount of change required while using the smallest possible total number of coins). In the Republic of Snoldova, however, the only coin denominations are the snoldi (11 cents), the snarki (8 cents), and the snook (I cent). In the box below, demonstrate that for the Snoldovan system of coinage the greedy algorithm described above does not always give an optimal solution to the "making change" problem. Give a value of n (the amount of change required, in cents), the corresponding solution produced by the greedy algorithm above, and a different solution consisting of fewer coins than are used in the greedy algorithm s solution. (amount of change to make, in cents) Greedy solution:-snoldis+ snarkis+ snooks sna Optimal solution:snoldis+ snarkis + snooks

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

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions

Question

=+ What are the information and consultation requirements?

Answered: 1 week ago