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

Polar to cartesian conversion formulas, Polar to Cartesian Conversion Formu...

Polar to Cartesian Conversion Formulas x = r cos Θ y = r sin Θ Converting from Cartesian is more or less easy.  Let's first notice the subsequent. x 2 + y 2   = (r co

Tutor, I AM A EXPERT OF MATHEMATICS.CAN I BECOME A TUTOR? PLEASE TELL ME SO...

I AM A EXPERT OF MATHEMATICS.CAN I BECOME A TUTOR? PLEASE TELL ME SOON.

Subtract, Ask question Minimum 100 words accepted# 1000-101

Ask question Minimum 100 words accepted# 1000-101

Quantitative Techniques, You are given that the total frequency is 900 and ...

You are given that the total frequency is 900 and the median 100.48. From the following frequency distribution, find the class frequencies that are missing. Intelligence No. of Int

Determine fog and gof, Let g be a function from the set G = {1,2,3,...34,35...

Let g be a function from the set G = {1,2,3,...34,35,36).  Let f be a function from the set F = {1,2,3,...34,35,36}.  Set G  and F contain 36 identical elements (a - z and 0 - 9).

Formular for x and y, I have a simple right angle triangle. All I am given...

I have a simple right angle triangle. All I am given is h (the hypotenuse) and that ratio of x:y is 2:3. What is the formula to find x and y in terms of h?

Conjugate of the complex number, The conjugate of the complex number a + b ...

The conjugate of the complex number a + b i is the complex number a - b i .  In other terms, it is the original complex number along the sign on the imaginary part changed.  Here

Calculus!, x+2y^2=63 and 4x+y^2=0; Find the area of the regions enclosed by...

x+2y^2=63 and 4x+y^2=0; Find the area of the regions enclosed by the lines and curves.

Dropped down the rational expression to lowest terms, Carry out the indicat...

Carry out the indicated operation and dropped down the answer to lowest terms.  (x 2 - 5x -14/ x 2 -3x+2) .   (x 2 - 4)/x 2 -14x+49) Solution This is a multiplication.

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