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

3-d geometry, Q) In 3D-geometry give + and - signs for x,y,z, in all eight ...

Q) In 3D-geometry give + and - signs for x,y,z, in all eight octants Ans) There is no specific hard rule for numbering the octants. So, it makes no real sense to ask which octan

Example on discrete mathematics, Suppose that at some future time every tel...

Suppose that at some future time every telephone in the world is assigned a number that contains a country code, 1 to 3 digits long, that is, of the form X, XX , XXX or followed

System of first order equations, Consider the Van der Pol oscillator x′′...

Consider the Van der Pol oscillator x′′- µ(1 - x 2 )x′ + x = 0 (a) Write this equation as a system of first order equations (b) Taking µ = 2, use MatLab's routine ode45 to

How much, If one acre costs $2500 how much does .39 of an acre cost

If one acre costs $2500 how much does .39 of an acre cost?

Solid mensuration, a circle is circumscribed about an equilateral triangle ...

a circle is circumscribed about an equilateral triangle whose side is 3 cm. find the area of the circle.

Use the definition of the right- and left-handed limits, Use the definition...

Use the definition of the limit to prove the given limit. Solution Let ε> 0 is any number then we have to find a number δ > 0 so that the following will be true. |

Factors, what are the factors af 34?

what are the factors af 34?

Area of a circle, There's a nice way to show why the expresion for the area...

There's a nice way to show why the expresion for the area of a circle of radius R is: Pi * R 2 . It has an comman relationship with the experation for the circumference of a

Determine z-scores and percentiles, Q. Determine Z-scores and Percentiles? ...

Q. Determine Z-scores and Percentiles? Ans. Z-scores help measure how far a piece of data is from the mean. More specifically, Z-scores tell how far a piece of data is fr

Estimate whose time was the fastest, Nancy, Jennifer, Alex, and Joy ran a r...

Nancy, Jennifer, Alex, and Joy ran a race. Nancy's time was 50.24 seconds, Jennifer's was 50.32, Alex's was 50.9, and Joy's was 50.2. Whose time was the fastest? The fastest ti

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