**COP3530 Recitation Exercises 3/4/03 **

**(all taken from the text ppg 282-3, with slight modifications) **

**1)**

(R-5.1) Let S = {a, b, c, d, e, f, g} be a collection of objects with benefit-weight values as follows: a: (12, 4), b:(10,6), c:(8,5), d:(11,7), e:(14,3), f:(7,1), and f:(9,6). What is an optimal solution to the fractional knapsack rpoblem for S assuming we have a sack that can hold objects with total weight 18. What is the optimal solution for the 0-1 knapsack problem given the seven indivisbile items a, b, c, d, e, f, and g?

**2)**

(R-5.4) Solve each of the following recurrences using the master method. a) T(n) = 2T(n/2)+log n b) T(n) = 8T(n/2) + n

2 c) T(n) = 16T(n/2) + (nlogn)

4 d) T(n) = 7T(n/3) + n e) T(n) = 9T(n/3) + n

3 logn

**3)**

(R-5.5) Use the divide and conquer algorithm from Section 5.2.2 to compute 10110011 x 10111010 in binary.

**4)**

(C-5.3) Describe an efficient greedy algorithm for making change for a specified value using a minimum number of coins, assuming you have only quarters, dimes, nickels and pennies. Argue why your algorithm is correct.

**5)**

(C-5.4) Give an example set of denominations of coins so that a greedy change making algorithm will not use the minimum number of coins. (These denominations should not be identical to our standard set of coins.)