Question: 5. (3 points) Consider a hypothetical country Binary Land where they only use coins. There are n types of coins of denominations 1, 21, 22,

5. (3 points) Consider a hypothetical country Binary Land where they only use coins. There are n types of coins of denominations 1, 21, 22, 23, ...,2-1Suppose you are a bank teller in Binary Land and your job is to give money to customers for any requested value V that is an integer. You should minimize the number of coins while paying V units of money. Design an algorithm that takes V as input and outputs the payment method that minimizes the total number of coins. Give pseudocode. Prove that your algorithm returns an optimal solution and discuss running time of your algorithm. (The output can be an array containing non-negative integers [S1, S2, ..., Sn such that: -1 8-2-1 = V.) 5. (3 points) Consider a hypothetical country Binary Land where they only use coins. There are n types of coins of denominations 1, 21, 22, 23, ...,2-1Suppose you are a bank teller in Binary Land and your job is to give money to customers for any requested value V that is an integer. You should minimize the number of coins while paying V units of money. Design an algorithm that takes V as input and outputs the payment method that minimizes the total number of coins. Give pseudocode. Prove that your algorithm returns an optimal solution and discuss running time of your algorithm. (The output can be an array containing non-negative integers [S1, S2, ..., Sn such that: -1 8-2-1 = V.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
