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

Geometry, which kind of triangle has no congruent sides ?

which kind of triangle has no congruent sides ?

Solve for x and y liner equation, Solve for x , y (x + y - 8)/2   ...

Solve for x , y (x + y - 8)/2   =( x + 2  y - 14)/3 = (3 x + y - 12 )/ 11   (Ans: x=2, y=6) Ans :     x+ y - 8/2  =   x + 2y - 14 /3  =    3x+ y- 12/11

Explain histogramsin details, Explain Histogramsin details? Another way...

Explain Histogramsin details? Another way to display frequencies is by using a histogram. The following is an example of a histogram using the data from the previous example:

Grouping-categories of situations requiring division , Grouping - situatio...

Grouping - situations in which we need to find the number of portions of a given size which can be obtained from a given quantity. (e.g., if there are 50 children in a class and t

What are real numbers, The hole set of irrational and rational numbers is t...

The hole set of irrational and rational numbers is the set of real numbers and is representing by R. Thus, the real numbers can also be describe in terms of position of a point on

Determine the area of the shaded region, The diagram below shows the cross ...

The diagram below shows the cross section of a pipe  1/2  inch thick that has an inside diameter of 3 inches. Determine the area of the shaded region in terms of π. a. 8.75π i

Apply depth-first-search to find out the spanning tree, Apply depth-first-s...

Apply depth-first-search to find out the spanning tree for the subsequent graph with vertex d as the starting vertex.        Ans: Let us begin with node'd'. Mark d as vi

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