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

How many inches long is the bedroom, Raul's bedroom is 4 yards long. How ma...

Raul's bedroom is 4 yards long. How many inches long is the bedroom? There are 36 inches within a yard; 4 × 36 = 144 inches. There are 144 inches in 4 yards.

Limit properties, Limit Properties :  The time has almost come for us t...

Limit Properties :  The time has almost come for us to in fact compute some limits.  Though, before we do that we will require some properties of limits which will make our lif

Prove, Let Xn be a sequence of distinct real numbers. Defi ne E = {L : L is...

Let Xn be a sequence of distinct real numbers. Defi ne E = {L : L is a subsequential limit of Xn}. Prove E is closed.

Geometry, #pqrs is a parallelogram its adjacent side is 2:1.state tHE angle...

#pqrs is a parallelogram its adjacent side is 2:1.state tHE angles

Word or term for, An irregular perimeter to the circumference of a circle s...

An irregular perimeter to the circumference of a circle such as a protrusion

Rules of logarithms, Rule 1 The logarithm of 1 to any base is 0. Pro...

Rule 1 The logarithm of 1 to any base is 0. Proof We know that any number raised to zero equals 1. That is, a 0 = 1, where "a" takes any value. Therefore, the loga

prove area of rhombus on hypotenuse right-angled triangle, Prove that the ...

Prove that the area of a rhombus on the hypotenuse of a right-angled triangle, with one of the angles as 60o, is equal to the sum of the areas of rhombuses with one of their angles

Example of hcf, Example  Find the Highest Common Factor of 54, 72...

Example  Find the Highest Common Factor of 54, 72 and 150. First we consider 54 and 72. The HCF for these two quantities is calculated as follows:

Unit rates, which shows the rate 12 inches of rain in 6 hours as a unit rat...

which shows the rate 12 inches of rain in 6 hours as a unit rate

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