QuestionQuestion

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

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....
$5.00 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.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
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