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

Determine equation of tangent line, Determine equation of the tangent line ...

Determine equation of the tangent line to f (x) = 4x - 8 √x  at x = 16 . Solution : We already know that the equation of a tangent line is specified by,

Saddle point-game theory, Saddle Point This point in a pay off matrix i...

Saddle Point This point in a pay off matrix is one which is the largest value in its column and the smallest value in its row. This is also termed as equilibrium point in the t

Array -categories of multiplication, Array - when items are arranged in a ...

Array - when items are arranged in a regular rectangular pattern of rows and columns, counting how many there are. (e.g., if there are 3 rows of 5 girls each, how many girls are t

Statistics, If a mean score is 89 with a standard deviation of 8 points. Wh...

If a mean score is 89 with a standard deviation of 8 points. What is the least score you can make and be in the top 20%?

The arithmetic mean, Arithmetic mean Arithmetic means is commonly know...

Arithmetic mean Arithmetic means is commonly known as average or mean it is acquired by first of all summing up the values provided and by dividing the total value by the tota

Good investment, Realtors estimate that 23% of homes purchased in 2004 were...

Realtors estimate that 23% of homes purchased in 2004 were considered investment properties. If a sample of 800 homes sold in 2004 is obtained what is the probability that at most

Generate a 30-ounce solution which was 28% acid, A chemist mixed a solution...

A chemist mixed a solution which was 34% acid with another solution that was 18% acid to generate a 30-ounce solution which was 28% acid. How much of the 34% acid solution did he u

Integration, R={(r, ?):1=r= 2cos? ,-p/3= ? =p/3

R={(r, ?):1=r= 2cos? ,-p/3= ? =p/3

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