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

Compute simple addition, John was doing his homework on vertical addition, ...

John was doing his homework on vertical addition, and had to compute : 5 3+ 3 4  and 6 8 +45 He did the first one easily, just the way his teacher had taught him. He first ad

Factorization example, Example  Factorize x 2 - 4x + 4. If ...

Example  Factorize x 2 - 4x + 4. If we substitute x = 1, the value of the expression will be (1) 2 - 4(1) + 4 = 1 If we substitute x = -1, the value o

Word problem, A computer is programmed to scan the digits of the counting n...

A computer is programmed to scan the digits of the counting numbers.For example,if it scans 1 2 3 4 5 6 7 8 9 10 11 12 13 then it has scanned 17 digits all together. If the comput

What is a negative number, Q. What is a Negative Number? Ans. Neg...

Q. What is a Negative Number? Ans. Negative numbers  are very important in mathematics. We say that positive and negative numbers are  opposites  of one another. Here

Elli[ital paths of celestial bodies, Create a detailed diagram to describe ...

Create a detailed diagram to describe the equation of an ellipse in terms of it’s eccentricity and indicate how the foci and major and minor semi-axes are involved. Y

Determine the volume of the pool, An inground pool is pooring with water. T...

An inground pool is pooring with water. The shallow end is 3 ft deep and gradually slopes to the deepest end, which is 10 ft deep. The width of the pool is 30 ft and the length is

Potency of a drug , An experiment designed to test the potency of a drug on...

An experiment designed to test the potency of a drug on 20 rats. Last animal studies have shown that a 10 mg dose of the drug is lethal 5% of the time within the first 4 hours; of

Examples of play and learning maths, Here are a few examples of some team g...

Here are a few examples of some team games. The teams can be small (1-3 children) or big (15-20 children). We start with some games for small children. a) One team places a numb

Surface area with parametric equations, Surface Area with Parametric Equati...

Surface Area with Parametric Equations In this final section of looking at calculus applications with parametric equations we will take a look at determining the surface area o

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