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, for1<i≤n,vi =c·vi−1.
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 PreviewSolution Preview

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.


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:

for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Data Structures and Algorithms Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats