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

Critical points, Critical Point Definition : We say that x = c is a critic...

Critical Point Definition : We say that x = c is a critical point of function f(x) if f (c) exists & if either of the given are true. f ′ (c ) = 0        OR             f ′ (c

50+50, what is the totel

what is the totel

Elementary row operations, Anne, Betty and Carol went to their local produc...

Anne, Betty and Carol went to their local produce store to buy some fruit. Anne bought one pound of apples and two pounds of bananas and paid $2.11. Betty bought two pounds of appl

Trignometric function, If tanx+secx=sqr rt 3, 0 Ans) sec 2 x=(√3-tanx) 2...

If tanx+secx=sqr rt 3, 0 Ans) sec 2 x=(√3-tanx) 2 1+tan 2 x=3+tan 2 x-2√3tanx 2√3tanx=2 tanx=1/√3 x=30degree

Steps for integration strategy - integration techniques, Steps for Integrat...

Steps for Integration Strategy 1. Simplify the integrand, if possible This step is vital in the integration process. Several integrals can be taken from impossible or ve

Multiply 3 (x + 4) = 3x + 12 to find out the total perimeter, Jake required...

Jake required to find out the perimeter of an equilateral triangle whose sides measure x + 4 cm each. Jake realized that he could multiply 3 (x + 4) = 3x + 12 to find out the total

Parametric curve - parametric equations & polar coordinates, Parametric Cur...

Parametric Curve - Parametric Equations & Polar Coordinates Here now, let us take a look at just how we could probably get two tangents lines at a point.  This was surely not

Fibonacci number, 1. Suppose n ≡ 7 (mod 8). Show that n ≠ x 2 + y 2 + z 2...

1. Suppose n ≡ 7 (mod 8). Show that n ≠ x 2 + y 2 + z 2 for any x, y, z ε Z. 2. Prove ∀n ε Z, that n is divisible by 9 if and only if the sum of its digits is divisible by 9.

Given a differential equation will a solution exist?, All differential equa...

All differential equations will doesn't have solutions thus it's useful to identify ahead of time if there is a solution or not. Why waste our time trying to get something that doe

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