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

Estimate what is the thickness of the paper, Kenny used a micrometer to mea...

Kenny used a micrometer to measure the thickness of a piece of construction paper. The paper measured halfway among 0.24 millimeters and 0.25 millimeters. What is the thickness of

Particular to general-how mathematical ideas grow, Particular to General : ...

Particular to General :  When I say 'tail', what do you think of? Do you think of the tail of a horse, or of a monkey? Or do you think of the tail of your pet dog? The tail of

Estimate the value of x and y in liner equation, ( a+2b)x + (2a - b)y = 2...

( a+2b)x + (2a - b)y = 2, (a - 2b)x + (2a +b)y = 3 (Ans: 5b - 2a/10ab , a + 10b/10ab ) Ans: 2ax + 4ay = y , we get 4bx - 2by = -1 2ax+ 4ay = 5  4bx- 2by = - 1

Example of learning to count, A parent shows his child four pencils. He pla...

A parent shows his child four pencils. He places them in a row in front of her and says "one" as he points to the first pencil, "two" as he points to the second one, "three" as he

Differential equation - maple, 1. Consider the following differential equat...

1. Consider the following differential equation with initial conditions: t 2 x'' + 5 t x' + 3 x = 0, x(1) = 3, x'(1) = -13. Assume there is a solution of the form: x (t) = t

Multiplying fractions involving negative numbers, Q. Multiplying Fractions ...

Q. Multiplying Fractions Involving Negative Numbers? Ans. If you have only one negative sign, the result is still negative: If you have more than one, just remembe

SOLID MENSURATION, The base of an isosceles triangle and the altitude drawn...

The base of an isosceles triangle and the altitude drawn from one of the congruent sides are equal to 18cm and 15cm, respectively. Find the lengths of the sides of the triangle.

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