Friday, March 16, 2012

a classical problem: coin change

Given a value in money N, and we want to change N into coins extracted from a set S={S1, ... Sm} of different coin values. How many diffferent ways to do we have to make the change. Assume that there are infinite coins of type Si.

Solution:

Define C(S, N, M) the way of changing the N given the M coins in S and compute the recursive solution

No comments:

Post a Comment