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

Bill traveled 117 miles in 2.25 hours what was his average, Bill traveled 1...

Bill traveled 117 miles in 2.25 hours. What was his average speed? Use the formula d = rt (distance = rate × time). Substitute 117 miles for d. Substitute 2.25 hours for t and

Draw tangent graph y = sec ( x ), G raph y = sec ( x ) Solution: As wi...

G raph y = sec ( x ) Solution: As with tangent we will have to avoid x's for which cosine is zero (recall that sec x =1/ cos x) Secant will not present at

Ratios, a doctor sees 3 boys to 5 girls in one week . If he sees 40 boys in...

a doctor sees 3 boys to 5 girls in one week . If he sees 40 boys in one day then how many girls does he see that day

Geometry, What is the better buy?a square pizza measuring 8 inches by 8inch...

What is the better buy?a square pizza measuring 8 inches by 8inches that cost $10 or a round pizza with a 9 inch diameter that also cost $10?

Calculate values of kinetics , A reaction following first-order kinetics wa...

A reaction following first-order kinetics was studied by determining the reactant concentrations at equal time intervals. Each successive pair of concentrations, [A] o and [A] 1

Example of 3-d coordinate system, Example of 3-D Coordinate System Exam...

Example of 3-D Coordinate System Example: Graph x = 3 in R, R 2 and R 3 .   Solution In R we consist of a single coordinate system and thus x=3 is a point in a 1-D co

Topology, Is usual topology on R is comparable to lower limit topology on R...

Is usual topology on R is comparable to lower limit topology on R

Explain graphing equations with a negative slope, Explain Graphing Equation...

Explain Graphing Equations with a Negative Slope? If the slope is a negative fraction, place the negative sign on either the numerator or the denominator. Example graph y = -2/

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