Question

Given a value V, we need to make change for V paisa’s with the fewest number...

Given a value V, we need to make change for V paisa’s with the fewest number of coins, using the coins in the given coin denominations, coins []={C1, C2, .. , Cn}.

  1. Design a greedy technique ‘pseudo-code’ for the ‘Coin change’ problem
  2. With an example prove that your pseudo-code is a greedy technique.
  3. With an example discuss whether your pseudo-code is an optimal solution for this problem.

Note: Assume unlimited supply of coins of given denominations.

Homework Answers

Answer #1

1)

1) Initialize result as empty.
2) find the largest denomination that is 
   smaller than V.
3) Add found denomination to result. Subtract 
   value of found denomination from V.
4) If V becomes 0, then print result.  
   Else repeat steps 2 and 3 for new value of V

2)

3)

For example, the greedy approach doesn’t work for denominations {9, 6, 5, 1} and V = 11. It would give 9, 1 and 1. But we can use 2 denominations 5 and 6.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Problem Description Many recipes tend to be rather small, producing the fewest number of servings that...
Problem Description Many recipes tend to be rather small, producing the fewest number of servings that are really possible with the included ingredients. Sometimes one will want to be able to scale those recipes upwards for serving larger groups. This program's task is to determine how much of each ingredient in a recipe will be required for a target party size. The first inputs to the program will be the recipe itself. Here is an example recipe that comes from...
Use Python 3.8: Problem Description Many recipes tend to be rather small, producing the fewest number...
Use Python 3.8: Problem Description Many recipes tend to be rather small, producing the fewest number of servings that are really possible with the included ingredients. Sometimes one will want to be able to scale those recipes upwards for serving larger groups. This program's task is to determine how much of each ingredient in a recipe will be required for a target party size. The first inputs to the program will be the recipe itself. Here is an example recipe...
Suppose you are given a set S = {a1,a2,···,an} of tasks, where task ai requires pi...
Suppose you are given a set S = {a1,a2,···,an} of tasks, where task ai requires pi units of processing time to complete, once it has started. You have one computer on which to run these tasks, and the computer can run only one task at a time. Let ci be the completion time of task ai, that is, the time at which task ai completes processing. Your goal is to minimize the average completion time, that is, to minimize n1...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From the April 2004 Issue Save Share 8.95 In 1991, Progressive Insurance, an automobile insurer based in Mayfield Village, Ohio, had approximately $1.3 billion in sales. By 2002, that figure had grown to $9.5 billion. What fashionable strategies did Progressive employ to achieve sevenfold growth in just over a decade? Was it positioned in a high-growth industry? Hardly. Auto insurance is a mature, 100-year-old industry...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • The initial phase of the analysis with ANCOVA involves the statistical adjustments of the DV group...
    asked 4 minutes ago
  • True or False? If true, then explain why (try to prove it!). If false, then provide...
    asked 4 minutes ago
  • What is the exact output of the following program? using namespace std; const int MAX =...
    asked 7 minutes ago
  • 21.3 A restaurant seats 150 people and allows smoking. Estimate the required ventilation rate (make-up air...
    asked 27 minutes ago
  • [The following information applies to the questions displayed below.] Lexon Inc. is a large manufacturer of...
    asked 28 minutes ago
  • Consider the following gas-phase reaction: 3 NO(g) NO2(g) + N2O(g) Using data from Appendix C of...
    asked 47 minutes ago
  • 13.5 A researcher wants to study the association between heavy coffee consumption and urinary bladder cancer....
    asked 47 minutes ago
  • Helicopter blades withstand tremendous stresses. In addition to supporting the weight of a helicopter, they are...
    asked 52 minutes ago
  • How would cognitive therapists approach the treatment of depression? How might they criticize humanistic therapies? (INCLUDE...
    asked 1 hour ago
  • A sample of helium behaves as an ideal gas as it is heated at constant pressure...
    asked 1 hour ago
  • what are the phsyics misconceptions that students normally encounter in 'work, energy and power'. especially when...
    asked 1 hour ago
  • The bulk modulus for bone is 15.0 GPa. a-If a diver-in-training is put into a pressurized...
    asked 1 hour ago