N Coin Change
http://www.geeksforgeeks.org/dynamic-programming-set-7-coin-change/
We want to make change for N cents. and we have an infinite supply of set of coins. How many ways can we make the change to get N?
m is the size of the elements within set
n is the sum we are trying to achieve
int count(int set[], int m, int n) {
// there is one way to achieve
// when sum is 0: which is 0 coins
if(n == 0)
return 1;
if(n < 0)
return 0;
// if we have no elements within the
// array and n is greater than or equal o
// one, then there is no way to reach n, so
// we return 0
if(m <= 0 && n >= 1)
return 0;
// first part includes set[m - 1]
// second part excludes set[m - 1]
return count(set, m - 1, n) + count(set, m, n - set[m - 1]);
}