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.
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use 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: