Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C1. Purpose: Apply various algorithm design strategies to solve a problem, practice formulating and analyzing algorithms, implement an algorithm. In the US, coins are

C1. Purpose: Apply various algorithm design strategies to solve a problem, practice formulating and analyzing algorithms, implement an algorithm. In the US, coins are minted with denominations of 50, 25, 10, 5, and 1 cent. An algorithm for making change using the smallest possible number of coins repeatedly returns the biggest coin smaller than the amount to be changed until it is zero. For example, 17 cents will result in the series 10 cents, 5 cents, 1 cent, and 1 cent. a) Give a recursive algorithm that generates a similar series of coins for changing n cents. Don't use dynamic programming for this problem. b) Write an 0(1) (non-recursive!) algorithm to compute the number of returned coins. c) Show that the above greedy algorithm does not always give the minimum number of coins in a country whose denominations are 1, 6, and 10 cents. d) Given a set of arbitrary denominations C=(C1,..,Ca), describe an algorithm that

Step by Step Solution

3.46 Rating (146 Votes )

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_2

Step: 3

blur-text-image_3

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

A Pathway To Introductory Statistics

Authors: Jay Lehmann

1st Edition

0134107179, 978-0134107172

More Books

Students also viewed these Algorithms questions

Question

Explain the similarities and differences between NPV, PI, and EVA.

Answered: 1 week ago