Computing change for a given coin system, Mathematics

Assignment Help:

This problem involves the question of computing change for a given coin system. A coin system is defined to be a sequence of coin values v1 < v2 < . . . < vn, such that v1 = 1. For example, in the U.S. coin system we have six coins with values h1, 5, 10, 25, 50, 100i. The question is what is the best way to make change for a given integer amount A.

(a) Let c ≥ 2 be an integer constant. Suppose that you have a coin system where there are n types of coins of integer values v1 < v2 < . . . < vn, such that v1 = 1 and, for 1 < i ≤ n, vi = c · vi-1. (For example, for c = 3 and n = 4, an example would be h1, 3, 9, 27i.) Describe an algorithm which given n, c, and an initial amount A, outputs an n-element vector that indicates the minimum number of coins in this system that sums up to this amount. (Hint: Use a greedy approach.)

(b) Given an initial amount A ≥ 0, let hm1, . . . ,mni be the number of coins output by your  algorithm.

Prove that the algorithm is correct. In particular, prove the following:

(i) For 1 ≤ i ≤ n, mi ≥ 0

(ii) Pn

i=1mi · vi = A

(iii) The number of coins used is as small as possible Prove that your algorithm is optimal (in the sense that of generating the minimum number of coins) for any such currency system.

(c) Give an example of a coin system (either occurring in history, or one of your own invention) for which the greedy algorithm may fail to produce the minimum number of coins for some amount.

Your coin system must have a 1-cent coin.


Related Discussions:- Computing change for a given coin system

Even and odd functions, Even and Odd Functions : This is the final topic ...

Even and Odd Functions : This is the final topic that we have to discuss in this chapter.  Firstly, an even function is any function which satisfies,

Fractions, Andre''s boss asked him to arrange bolts placing the shortest bo...

Andre''s boss asked him to arrange bolts placing the shortest bolt near the front 1 and three fourth inch 1 and 5 eigths 1 and 11 sixteenths which is the shortest

Calculate the regular monthly payments, A washing machine, cash price $ 850...

A washing machine, cash price $ 850 is available on the following terms: A deposit of $ 100 followed by equal payments at the end of each month for the next 18 months, if intere

Hello, dans chaque cas recris l expression sous la forme d un rappot reduit...

dans chaque cas recris l expression sous la forme d un rappot reduit 5kg/600g

Which of the following could the length of the base height, The area of a p...

The area of a parallelogram can be expressed as the binomial 2x 2 - 10x. Which of the following could be the length of the base and the height of the parallelogram? To ?nd out

#tnumarancyitle.., what is classification and how can you teach it?

what is classification and how can you teach it?

Marketing of herbal products , To help Himalya herbal launch a successful m...

To help Himalya herbal launch a successful marketing campaign in the UK

John 47 out of 86 free-throws who best free-throw shooter, Michael made 19 ...

Michael made 19 out of 30 free-throws this basketball season. Larry's freethrow average was 0.745 and Charles' was 0.81. John made 47 out of 86 free-throws. Who is the best free-th

Determine the line parallel or perpendicular, Determine if the line that pa...

Determine if the line that passes through the points ( -2, -10) and (6, -1) is parallel, perpendicular or neither to the line specified  by 7 y - 9 x = 15 . Solution Togive

Math reasoning, The probability that a certain region in mexico will be hit...

The probability that a certain region in mexico will be hit by a hurricane in any given year is .06. What is the probability that the region will be hit by at least one hurricane i

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd