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

Runge kutta method, As noted, Euler's method is little used in practice, as...

As noted, Euler's method is little used in practice, as there are much better ways of solving initial value problems. By better, we mean, "able to achieve a result of the same prec

Solving trig equations with calculators part ii, Solving Trig Equations wit...

Solving Trig Equations with Calculators, Part II : Since this document is also being prepared for viewing on the web we split this section into two parts to keep the size of the

What percent the girls surveyed said that area hockey sport, 450 girls were...

450 girls were surveyed about their favorite sport, 24% said in which basketball is their favorite sport, 13% said in which ice hockey is their favorite sport, and 41% said which s

Special forms of polynomial, Special Forms There are a number of nice s...

Special Forms There are a number of nice special forms of some polynomials which can make factoring easier for us on occasion. Following are the special forms. a 2 + 2ab +

The cost of renting a bike at the local bike is y = 2x + 2, The cost of re...

The cost of renting a bike at the local bike shop can be represented through the equation y = 2x + 2, where y is the total cost and x is the number of hours the bike is rented. Whi

How to solve systems of equations, How to solve Systems of Equations ? ...

How to solve Systems of Equations ? There's a simple method that you can use to solve most of the systems of equations you'll encounter in Calculus. It's called the "substitut

Determine the displacement, Example: A 16 lb object stretches a spring 8/9...

Example: A 16 lb object stretches a spring 8/9 ft by itself. Here is no damping as well as no external forces acting on the system. The spring is firstly displaced 6 inches upward

Addition of like terms with same signs, Case 1: Suppose we are given...

Case 1: Suppose we are given expressions like 3abc and 7abc and asked to compute their sum. If this is the case we should not worry much. Because adding like exp

Sequences - calculus, Sequences Let us start off this section along wi...

Sequences Let us start off this section along with a discussion of just what a sequence is. A sequence is nothing much more than a list of numbers written in a particular orde

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