CSCI 2300 Lab 7 Spring 2015, 4/01/15

This lab is about Greedy Algorithm.
  1. Implement a C++ program for Greedy Coin Change problem with denominations 50 cents, 25 cents, 10 cents, 5 cents and 1 cents coin. (Read exercise 16-1, CLRS edition 3, Page 446 - titled Coin Changing and think about all sub problems)
    Input: Any positive integer n
    Output: Minimum number of coins required that add up to n.
    Also calculate the average number of changes needed for changing 1 cents to 99 cents with and with out 50 cents.
    Once you are done with this, try for denominations 6, 5, 1 and try to get change for 10. Can you do better than (with less number of coins) what greedy algorithm gives.
    Please read Interesting article in Nature and Slashdot article about coin changes.
  2. (optional - but highly recommended to get a practice for solving greedy algorithms) 5.32 (DG) (in the printed version) 5.31(in the online PDF version) - (Hint: Sort the service times in inreasing order of service timess)
  3. 5.18 a,b (DG) - For this you can use the code Huffman Code and have the appropriate input. Dan Ibanez's code ( fixing memory leaks in Huffman Code). He has shared his correctly working code huffman.cxx with you. Please feel free to use his code.
  4. Spanning Tree Game problem to get an intuition how to build spanning tree. (needs Java) - It is a Java applet