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

profit & loss, A sell a watch to B at gain of 20% and B sell to C at loss ...

A sell a watch to B at gain of 20% and B sell to C at loss of 10%. if C pays @ 432, how much did A pays for it.

Mathematical methods of economic analysis, I need answers for these 10 exam...

I need answers for these 10 exam questions: 1.Input-output (Leontief) model: main assumptions and construction. Definition of productivity. Necessary condition of productivity of i

Euler method for ode, y'' + 2y = 2 - e-4t, y(0) = 1 use euler''s method wit...

y'' + 2y = 2 - e-4t, y(0) = 1 use euler''s method with a step size of 0.2 to find and approximate values of y

Area with parametric equations - polar coordinates, Area with Parametric Eq...

Area with Parametric Equations In this section we will find out a formula for ascertaining the area under a parametric curve specified by the parametric equations, x = f (t)

VECTORS, OQRS IS A QUADRILATERAL SUCH THAT OQ= -6,3 OR= -3,7 AND OS= 1,5. T...

OQRS IS A QUADRILATERAL SUCH THAT OQ= -6,3 OR= -3,7 AND OS= 1,5. T IS ON OQ SUCH THAT OT: TQ= 1:2 PROVE THAT QRST IS AA PARALLEGRRAM

Probability, Mike sells on the average 15 newspapers per week (Monday – Fri...

Mike sells on the average 15 newspapers per week (Monday – Friday). Find the probability that 2.1 In a given week he will sell all the newspapers

Find the generating function, Find the generating function for the number o...

Find the generating function for the number of r-combinations of {3.a, 5.b, 2.c}          Ans:  Terms sequence is given as r-combinations of {3.a, 5.b, 2.c}. This can be writte

Calculate the average return, A department store faces a decision for a sea...

A department store faces a decision for a seasonal product for which demand can be high, medium or low. The purchaser can order 1, 2 or 3 lots of this product before the season beg

Using euclid''s algorithm find the value of x & y, If d is the HCF of 30, 7...

If d is the HCF of 30, 72, find the value of x & y satisfying d = 30x + 72y. (Ans:5, -2 (Not unique) Ans:    Using Euclid's algorithm, the HCF (30, 72) 72 = 30 × 2 + 12

Lines, i dont understand angels and lines

i dont understand angels and lines

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