We consider a coin-changing problem. For a currency with coins C, C2, ..., CN, the problem...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
We consider a coin-changing problem. For a currency with coins C₁, C2, ..., CN, the problem is to find the minimum number of coins needed to make x dollars of change, as well as how many coins are needed for each of c, where 1 ≤ i ≤ N, assuming there are always enough coins. For example, in Hong Kong, we have 0.1-dollar, 0.2-dollar, 0.5-dollar, 1-dollar, 2-dollar, 5- dollar and 10-dollar coins. For x = 63.7, the minimum number of coins is 10: 6 x 10-dollar coins, 1x 2-dollar coin, 1 x 1-dollar coin, 1 x 0.5-dollar coin and 1 x 0.2 dollar coin. You can assume x must be a sum of the face value of coins. Write the pseudocode to solve this problem. We consider a coin-changing problem. For a currency with coins C₁, C2, ..., CN, the problem is to find the minimum number of coins needed to make x dollars of change, as well as how many coins are needed for each of c, where 1 ≤ i ≤ N, assuming there are always enough coins. For example, in Hong Kong, we have 0.1-dollar, 0.2-dollar, 0.5-dollar, 1-dollar, 2-dollar, 5- dollar and 10-dollar coins. For x = 63.7, the minimum number of coins is 10: 6 x 10-dollar coins, 1x 2-dollar coin, 1 x 1-dollar coin, 1 x 0.5-dollar coin and 1 x 0.2 dollar coin. You can assume x must be a sum of the face value of coins. Write the pseudocode to solve this problem.
Expert Answer:
Answer rating: 100% (QA)
You can solve the coinchanging problem using dynamic programming Heres a pseudocode to find the mini... View the full answer
Related Book For
Managing Business Ethics Making Ethical Decisions
ISBN: 9781506388595
1st Edition
Authors: Alfred A. Marcus, Timothy J. Hargrave
Posted Date:
Students also viewed these programming questions
-
What mechanism is used to provide a systematic assessment of an organization's performance in implementing socially responsible programs, often based on predefined goals?
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
Describe the variables you would include in a simple algorithm that could be used to achieve the objectives of your group's country portfolio including any adjustments or improvements you would like...
-
Suppose that a nonnegative function y = (x) has a continuous first derivative on [a, b]. Let C be the boundary of the region in the xy-plane that is bounded below by the x-axis, above by the graph of...
-
Recently, a government official in Europe stated that the European Central Bank needs to weaken the euro in order to improve the European economy. Write a short essay that explains the logic behind...
-
The Cash general ledger account balance of Gladstone Ltd. was $2,531 at March 31, 2015. On this same date, the bank statement had a balance of $1,500. The following discrepancies were noted: a. A...
-
Haupt Consulting, Inc., completed the following transactions during the first half of December, 2010: Requirements 1. Open T-accounts in the ledger: Cash, Accounts receivable, Supplies, Equipment,...
-
When a tennis player serves, he gets two chances to serve in bounds. If he fails to do so twice, he loses the point. If he attempts to serve an ace, he serves in bounds with probability 3/8. If he...
-
Northam Packaging Company produced 2,06,000 tons of coated paper board in 1989. This paper board was sold to consumer product firms ( processors) who formed the paper board into cartons, then filled...
-
During the boom years of 2010-2014, ace mutual fund manager Diana Sauros produced the following percentage rates of return. Rates of return on the market are given for comparison. Calculate the...
-
Sefi is a journalist investigating corruption in the government. She receives a tip from a confidential source about a high-level official's involvement in a bribery scheme. To confirm the tip, Sefi...
-
9.29 A capillary-tube flowmeter is being constructed to measure the flow rate of water. The glass tubing has an inside diameter of 1.50 mm and the pressure taps are located 0.35 m apart. (a) Estimate...
-
Describe the 3 main causes of Data Breaches? What are the 5 rights as discussed in the chapter? Make an example to every one of the five rights from above?
-
Rating Agencies rate the credit of the tranches. i. What are the top 3 credit risk variables that determine the credit rating of a tranche? ii. In the Global Financial Crisis, did the rating agencies...
-
You have validated the following information from a contractor's proposal: 2012 (actual) $1,375,000 Year Allocation Base Expense Pool $250,550 2013 (actual) $1,490,000 $275,300 2014 (actual)...
-
Identify the key roles and responsibilities of team members implementing the financial management approach and/or making financial decisions. Consider responsibilities for purchasing, invoicing,...
-
Construct a Boolean expression for the input/output table shown in Table 1. Construct a circuit to represent the input/output table shown in Table 1. (10 marks) (10 marks)
-
You are a U.S. investor who purchased British securities for 2,000 one year ago when the British pound cost U.S. $1.50. What is your total return (based on U.S. dollars) if the value of the...
-
Since the time that companies began to hire full-time diversity managers, they often have tried to make their organizations more hospitable to people of allsexes. Atlantic Information Systems Inc. is...
-
You work at the front desk of a hotel in a small town near the border between the United States and Mexico. When you check in guests, you ask them to show identification and provide the make, model,...
-
Mayo Elton is the chief ethics officer at Hawthorne Manufacturing. He has established a code of conduct that prohibits stealing supplies and equipment from the factory floor and also imposes strict...
-
The inverting op-amp circuit in Figure 9.9 has parameters \(R_{1}=20 \mathrm{k} \Omega\), \(R_{2}=200 \mathrm{k} \Omega\), and \(A_{o d}=5 \times 10^{4}\). The output voltage is \(v_{O}=-4.80...
-
The circuit in Figure P9.28 is similar to the inverting amplifier except the resistor \(R_{3}\) has been added. (a) Derive the expression for \(v_{O}\) in terms of \(v_{I}\) and the resistors. (b)...
-
(a) Consider the op-amp circuit in Figure P9.27. The open-loop gain of the op-amp is \(A_{o d}=2.5 \times 10^{3}\). (i) Determine \(v_{O}\) when \(v_{I}=-0.80 \mathrm{~V}\). (ii) What is the percent...
Study smarter with the SolutionInn App