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

Viscosity measure, get the viscosity of particle to apply the stoke''s law

get the viscosity of particle to apply the stoke''s law

Congruence, a) Let n = (abc) 7 . Prove that n ≡ a + b + c (mod 6). b) U...

a) Let n = (abc) 7 . Prove that n ≡ a + b + c (mod 6). b) Use congruences to show that 4|3 2n   - 1 for all integers n ≥ 0.

By the method of completion of squares solve equation, By the method of com...

By the method of completion of squares show that the equation 4x 2 +3x +5 = 0 has no real roots. Ans:    4 x 2 +3 x +5=0 ⇒  x 2 + 3/4 x + 5 = 0 ⇒   x 2 + 3/4 x +

Determine the area of the rectangle, Stuckeyburg is a very small town in ru...

Stuckeyburg is a very small town in rural America. Use the map to approximate the area of the town. a. 40 miles 2 b. 104 miles 2 c. 93.5 miles 2 d. 92 miles 2

Tent originally sold for $2 what is the percent of discount, A tent origina...

A tent originally sold for $260 and has been marked down to $208. What is the percent of discount? Find out the number of dollars off. $260 - $208 = $52. Further, determine wha

Algebra, Tom has five times as many marbles as Jim. together they have 42 m...

Tom has five times as many marbles as Jim. together they have 42 marbles. how many marbles does each has?

Calculus, what is a domain of a function?

what is a domain of a function?

Least common multiple (lcm), Before we look at this, let us learn wha...

Before we look at this, let us learn what a multiple is. Take any number say 3. Multiply this number with natural numbers. We obtain 3, 6, 9, 12, 15, 18,.........

Which of the subsequent binomials could represent the length, The area of a...

The area of a rectangle is represented through the trinomial: x 2 + x - 12. Which of the subsequent binomials could represent the length and width? Because the formula for the

High dimensions, List the five most important things you learned about high...

List the five most important things you learned about high dimensions.

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