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

Express the negation of the statement, States the negation of the statement...

States the negation of the statement ∀x ∃y (xy = 1) so that no negation precedes a quantifier. Ans: The negation of the following statement is written as ~ [∀x ∃y (xy = 1)]. An

Matrix inverse, Here we need to see the inverse of a matrix. Provided a squ...

Here we need to see the inverse of a matrix. Provided a square matrix, A, of size n x n if we can get the other matrix of similar size, B that, AB = BA = I n after that we call

Algegra, what''s the main purpose of algebra in our daily life

what''s the main purpose of algebra in our daily life

Real analysis, .find lim sup Ek and liminf Ek of Ek=[(-(1/k),1] for k odd a...

.find lim sup Ek and liminf Ek of Ek=[(-(1/k),1] for k odd and liminf Ek=[(-1,(1/k)] for k even

Hasse diagram, The digraph D for a relation R on V = {1, 2, 3, 4} is shown ...

The digraph D for a relation R on V = {1, 2, 3, 4} is shown below (a) show that (V,R) is a poset. (b) Draw its Hasse diagram. (c) Give a total order that have R.

Example of pythagorean theorem, Any 15 foot ladder is resting against the w...

Any 15 foot ladder is resting against the wall. The bottom is at first 10 feet away from the wall & is being pushed in the direction of the wall at a rate of 1 ft/sec. How rapid is

Algebra, sir/madam, i abdulla working as a maths teacher want to join ur es...

sir/madam, i abdulla working as a maths teacher want to join ur esteemed organisation as a tutor how can i proceed i have created an account even pls guide me, thanks abdulla

Division of two like terms, Case 1: Suppose we have two terms 8ab and 4ab. ...

Case 1: Suppose we have two terms 8ab and 4ab. On dividing the first by the second we have 8ab/4ab = 2 or 4ab/8ab = (1/2) depending on whether we consider either 8ab or 4ab as the

Modulo Arithmetic, What is Modulo Arithmetic and what is an easy way to rem...

What is Modulo Arithmetic and what is an easy way to remember it?

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