Proving opmality for us coins lemma 1

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview:   Optimization problems can be solved using a greedy algorithm, which makes the “best” choice at each step. —༉  Making the “best choice” at each step does not necessarily produce an optimal solution to the overall problem, but in many instances, it does. —༉  The greedy approach is an algorithmic paradigm, which is a general approach for designing an algorithm. Greedy Algorithms: Making Change Example: design a greedy algorithm for making change of n cents with the following coins: quarters (25 cents), dimes (10 cents), nickels (5 cents), and pennies (1 cent), using the least number of coins. Solution: at each step choose the coin with the largest possible value that does not exceed the amount of change left. For instance: 1.  If n = 67 cents, first choose a quarter leaving 67−25 = 42 cents. Then choose another quarter leaving 42 −25 = 17 cents. 2.  Then choose a dime, leaving 17...
View Full Document

Ask a homework question - tutors are online