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, ﬁrst 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
 Spring '14
 M.Nojoumian
 Algorithms, Sort

Click to edit the document details