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

Determine how much more time it will take to reach the base, A man on a top...

A man on a top of a tower observes a truck at an angle of depression α where tanα = 1/√5 and sees that it is moving  towards the base of the tower. Ten minutes later, the angle of

What is minimum spanning tree, What is minimum spanning tree?  Determine a ...

What is minimum spanning tree?  Determine a railway network of minimal cost for the cities in the following graph using Kruskal's algorithm. Ans: Minimum spanning tree in a con

.fractions, what is the difference between North America''s part of the tot...

what is the difference between North America''s part of the total population and Africa''s part

Addition, in kannaha tiger reserve forest,there are 50 tigers and in bandha...

in kannaha tiger reserve forest,there are 50 tigers and in bandhavgarh reserve forest there are 35 tigers.how many tigers are there in all in both the forests

4 accounting majors, 4 accounting majors, 2 economics majors and 3 marketin...

4 accounting majors, 2 economics majors and 3 marketing majors have an interview for5 different positions with a large company. Find the number of dfferent ways that 5 of these c

Net Present Value, A business has the opportunity to expand by purchasing ...

A business has the opportunity to expand by purchasing a machine at a cost of £80,000. The machine has an estimated life of 5 years and is projected to generate a cashflow of £20,0

Index of summation - sequences and series, Index of summation - Sequences a...

Index of summation - Sequences and Series Here now, in the i is termed as the index of summation or just index for short and note that the letter we employ to represent

Relations, Suppose A and B be two non-empty sets then every subset of A Χ B...

Suppose A and B be two non-empty sets then every subset of A Χ B describes a relation from A to B and each relation from A to B is subset of AΧB. Normal 0 fals

Mean deviation, is that formula of sample and population for mean deviation...

is that formula of sample and population for mean deviation is the same?

Tied rankings, Tied Rankings A slight adjustment to the formula is mad...

Tied Rankings A slight adjustment to the formula is made if several students tie and have the similar ranking the adjustment is: (t 3 - t)/12 Whereas t = number of tied

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