Lab: Coin Change & Bin Packing


Greedy Coin Change Algorithm


while S > 0 do 

      c := value of the largest coin no larger than S; 

      num := S / c; 

      pay out num coins of value c; 

      S := S - num*c;