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

Markup & markdown, if prices are calculatead with a 35% markup based on cos...

if prices are calculatead with a 35% markup based on cost,what is the percent that those prices should be marked down to get back to their original cost?Choose any convenient cost

501, Ask queThe low temperature in Anchorage, Alaska today was -4°F. The lo...

Ask queThe low temperature in Anchorage, Alaska today was -4°F. The low temperature in Los Angeles, California was 63°F. What is the difference in the two low temperatures?stion #M

Trig/cosine/sine rule etc, #questiThe elevation of a telecommunication mast...

#questiThe elevation of a telecommunication mast from two points, one due North of the tower and the other South of it are 21.2 degrees and 24.3 degrees respectively, and the two p

Permutation and combination, The remainder when 5^99 is divided by 13 Ans) ...

The remainder when 5^99 is divided by 13 Ans) 8 is the remainder.

Liner regression, Liner Regression The calculations for our sample siz...

Liner Regression The calculations for our sample size n = 10 are described below. The linear regression model is y = a + bx Table: Distance x miles

List some maths activities-tasks-exercises for children, List some activiti...

List some activities/tasks/exercises that you would give a class of 50 children to do to make them aware about patterns, and to articulate what the patterns are. You must be won

Speed, Town x and town y were 270km apart. a car started from town x toward...

Town x and town y were 270km apart. a car started from town x towards town y at a uniform speed of 60km/hr, while a motorcycle started from town y to town x at a uniform speed of 9

Example to understanidng of multiplication, 6-year-old Rahul wasn't able to...

6-year-old Rahul wasn't able to understand multiplication when it was thrust upon him in school. His mother discussed this problem with some of us. On the basis of suggestions that

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