6. We want to count how many different ways there are of making change? For example, if the
coins we have available are COINS = \{1, 5, 10, 25\} cents and we want to make change for
12 cents, there are 4 ways: (1) give all 1-cent pieces, (2) give a 10-cent piece and two 1-cent
pieces, (3) give two 5-cent pieces and two 1-cent pieces, and (4) give one 5-cent piece and
seven 1-cent pieces. So, the answer in this case is 4.
We want to design a function $change(COINS, n)$ that outputs the number of ways to make
change for $n$ cents when the coin denominations available are those in COINS. For example,
$change(\{1, 5, 10, 25\}, 12)$ should return 4.
(a) Write a recursive definition to compute the number of ways to make change for n cents.
Give the most efficient algorithm you can to solve this problem. [11 pts.]
(b) Prove the optimal substructure property. [3 pts.]
(c) Prove the overlapping subproblems. [3 pts.]
(d) Analyze the time complexity. [3 pts.]