CSCI 2300 Lab 7 Fall 2011, 10/26/11
This lab is about Greedy Algorithm.
- 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.
- (optional - but highly recommended to get a practice for solving greedy algorithms) 5.32 (DG) - (Hint: Sort the service times in inreasing order of service timess)
- 5.18 a,b (DG) - For this you can use the code Huffman Code and have the appropriate input. One of UTA's Dan Ibanez emailed there may be memory leaks in Huffman Code. He has shared his correctly working code huffman.cxx with you. Please feel free to use.
- Spanning Tree Game problem to get an intuition how to build spanning tree.