My assignment is to write an algorithm using brute force to determine the number of distinct ways, an related combinations of change for given amount. The change will be produced using the following coins: penny (1 cent), nickel (5 cents), dime (10 cents), and quarter (25 cents).
e.g.
Input: 16 (it means a change of 16 cents)
Output: can be produced in 6 different ways and they are:
- 16 pennies.
- 11 pennies, 1 nickel
- 6 pennies, 1 dime
- 6 pennies, 2 nickels
- 1 penny, 3 nickels
- 1 penny, 1 nickel, 1 dime
My algorithm must produce all possible change combinations for a specified amount of change.
I am at a complete loss as to how to even begin starting an algorithm like this. Any input or insight to get me going would be awesome.