Suppose you've got some money, f.e. 120$
There are,f.e. 3 different coins, say 1$, 5$, and
10$. The task is to write a program with a recoursive function that calculates how many different ways there are to have 120$.
F.e. 10 times 10$ and 4 times 5$ would be 120$,
so increase a counter.
The final return value of the recoursive SolveIt()
function is the number of different ways to have a certain amount of money given the number of different coins and their values.
Can you solve this problem (it's difficult), is there an algorithm?



LinkBack URL
About LinkBacks



