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

Using pythagorean theorem solve z 2 = ( x + y )2 + 3502, Two people on bik...

Two people on bikes are at a distance of  350 meters.  Person A begin riding north at a rate of 5 m/sec and 7 minutes later on Person B begin riding south at 3 m/sec.  Determine th

Sketch the graph, Sketch the graph of                          y = ( x -...

Sketch the graph of                          y = ( x -1) 2  - 4 . Solution Now, it is a parabola .Though, we haven't gotten that far yet and thus we will have to select

Differential equations, Find the normalized differential equation which has...

Find the normalized differential equation which has {x, xex} as its fundamental set

#title.automotive cruise control system., What are some of the interestingm...

What are some of the interestingmodern developments in cruise control systems that contrast with comparatively basic old systems

What is a scatter diagram, What is a scatter diagram? A scatter diagram...

What is a scatter diagram? A scatter diagram is a graphical representation of data points for a particular sample. Choosing a dissimilar sample or enlarging the original one ca

Introduction to ones tens and more, INTRODUCTION :  We are often confronte...

INTRODUCTION :  We are often confronted with children not being able to deal with H T 0, i.e. 'hundreds', 'tens' and 'ones' (or 'units'), with comfort, though they are supposed to

PROBABILITY.., Urn A contains 1 white,2 black and 3 red balls;Urn B contain...

Urn A contains 1 white,2 black and 3 red balls;Urn B contains 2 white,1 black and 1 red balls;and Urn C contains 4 white,5 black and 3 red balls.One urn is chosen at random and two

Sequence and series, how can we prove that an absolute convergent series is...

how can we prove that an absolute convergent series is convergent but the converse is not true.

Frequency polygon, how to compute the frequncy polygon of the scores?

how to compute the frequncy polygon of the scores?

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