## Question

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.

Given an initial amount A ≥ 0, let ⟨m1, . . . , mn⟩ be the number of coins output by your algorithm. Prove that the algorithm is correct. In particular, prove the following:

( i i ) ni = 1 m i · v i = 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.

## Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

ii).If Sum (mi*vi) <A, it means that we did not get a solution, and this would contradict the algorithm from above regarding the choosing mode (i.e. in decreasing order of the denomination value). At each step of the algorithm A becomes the reminder, after mi*vi is computed for a certain i.

On the other hand, Sum (mi*vi) >A is not a possible solution, because that Sum cannot overflow the amount A to be paid using certain coin values vi. At no point from the algorithm Sum (mi*vi) is not greater than A, because of the Greedy approach....

By purchasing this solution you'll be able to access the following files:

Solution.docx.