Describe an efficient greedy algorithm for making change for a specified value using a minimum number...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Describe an efficient greedy algorithm for making change for a specified value using a minimum number of coins, assuming there are four denominations of coins (called dimes, nickels, quarters, and pennies), with values 10, 5, 25, and 1, respectively. The input of your algorithm is an integer number N representing the total number of cents. The out put specifies for each denomination how many coins are to be used. Here, "efficient" means O(N). 1. Present pseudocode, running time analysis, proof of correctness. 2. Find four denominations of coins, one of which is 1 cent, and one value of N for which the greedy algorithm fails to return the minimum number of coins. Show the greedy and optimum solutions. 3. Present a dynamic program for any set of k denominations. Strive for running time of O(kN), but make sure that the running time is polynomial in k and N. Present the pseudocode, discuss correctness, and analyze the running time. Describe an efficient greedy algorithm for making change for a specified value using a minimum number of coins, assuming there are four denominations of coins (called dimes, nickels, quarters, and pennies), with values 10, 5, 25, and 1, respectively. The input of your algorithm is an integer number N representing the total number of cents. The out put specifies for each denomination how many coins are to be used. Here, "efficient" means O(N). 1. Present pseudocode, running time analysis, proof of correctness. 2. Find four denominations of coins, one of which is 1 cent, and one value of N for which the greedy algorithm fails to return the minimum number of coins. Show the greedy and optimum solutions. 3. Present a dynamic program for any set of k denominations. Strive for running time of O(kN), but make sure that the running time is polynomial in k and N. Present the pseudocode, discuss correctness, and analyze the running time.
Expert Answer:
Answer rating: 100% (QA)
Lets break down the steps for the greedy algorithm to make change for a specified value using the mi... View the full answer
Related Book For
Data Structures and Algorithms in Java
ISBN: 978-1118771334
6th edition
Authors: Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
Posted Date:
Students also viewed these programming questions
-
According to the CDC, the average number of sick days workers are absent is 15 per year, with a standard deviation of 5 days. Assume a population size = 5000. From a random sample of 25 workers, what...
-
Describe an efficient greedy algorithm for making change for a specified value using a minimum number of coins, assuming there are four denominations of coins (called quarters, dimes, nickels, and...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Name four ways to mitigate the incentives for managers to overproduce.
-
The trial balance for Mackle Fitness, shown below, does not balance. The following errors were detected: a. The cash balance is overstated by $6,000. b. Rent expense of $3,000 was posted as a credit...
-
Selected financial data for DC Menswear is provided as follows: Required: 1. Calculate the return on equity for DC Menswear. How does it compare with the return on equity for Ralph Lauren and...
-
In 1906, the statistician Karl Pearson measured the heights of 1078 pairs of fathers and sons. The following table presents a sample of 16 pairs, with height measured in inches, simulated from the...
-
Fishel Company is working on two job orders. The job cost sheets show the following: Prepare the three summary entries to record the assignment of costs to Work in Process from the data on the job...
-
The exchange rate is $1.20/ Exchange rate volatility is 15%. The dollar interest rate is 5%. The euro interest rate is 9%. Both are continuously compounded rates. The price evolution of the euro...
-
The following salaried employees of Mountain Stone Brewery in Fort Collins, Colorado, are paid semimonthly. Some employees have union dues or garnishments deducted from their pay. Required: Calculate...
-
Fill in data from probability, cumulative, random number interval, random source demand, and demand based on random number intervals using the formula from excel 1 234567 19 20 A 21 22 Demand 0 1 2 3...
-
Avoca Ltd is a major retailer selling fishing rods and reels on the Central Coast of NSW. The following ratios are provided by management to assess the performance of the business over the last two...
-
A dice was rolled 126 times as shown by the frequency distribution below: Outcome Number of Rolls with each outcome 11.9% 13.5%. QUESTION: What is the probability that the dice will roll a "1"?
-
Use the following information about Rat Race Home Security, Inc. to answer the questions: Average selling price per unit $332. Variable cost per unit $185 Units sold 483 Fixed costs $6,522 Interest...
-
Dan Watson started a small merchandising business in Year 1 . The business experienced the following events during its first year of operation. Assume that Watson uses the perpetual inventory system....
-
Deacon Company is a merchandising company that is preparing a budget for the three - month period ended June 3 0 th . The following information is available Deacon Company Balance Sheet March 3 1...
-
What is the number of authorized shares per the charter? What is the number of issued shares? What is the number of outstanding shares? What was the total dollar amount (not per share) paid by the...
-
In a certain school district, 3% of the faculty use none of their sick days in a school year. Find the probability that 5 faculty members selected at random used no sick days in a given year.
-
Give a concrete implementation of the retainAll method for the set ADT, using only the other fundamental methods of the set. You are to assume that the underlying set implementation uses fail-fast...
-
Given a heap H and a key k, give an algorithm to compute all the entries in H having a key less than or equal to k. For example, given the heap of Figure 9.12a and query k =7, the algorithmshould...
-
Show that the worst-case running time of quick-select on an n-element sequence is (n 2 ).
-
Is it possible that the transfers into a PCU may not equal the transfers out of the same PCU on the same day?
-
What is an intrahospital transfer?
-
When must transfers in and transfers out be equal?
Study smarter with the SolutionInn App