Unformatted text preview: { d 1 , d 2 , . . . , d k } units. They seek an algorithm that will enable them to make change of n units using the minimum number of coins. You may assume that d 1 = 1, so it is always possible to make change for any n . (a) The greedy algorithm for making change repeatedly uses the biggest coin smaller than the amount to be changed until it is zero. Show that the greedy algorithm does not always give the minimum number of coins in a country whose denominations are { 1 , 6 , 10 } . (b) Give an O ( nk ) time algorithm that correctly determines the minimum number of coins needed to make change of n units using denominations { d 1 , d 2 , . . . , d k } . Justify the correctness and running time of your algorithm. c ± 2006 Chung Kai Lun Peter. Comments are welcomed. Email: [email protected] 1...
View
Full Document
 Spring '10
 may
 English, multiplication table, Chung Kai Lun Peter

Click to edit the document details