*** Welcome to piglix ***

Change-making problem


The change-making problem addresses the following question: how can a given amount of money be made with the least number of coins of given denominations? It is a knapsack type problem, and has applications wider than just currency.

Coin values can be modeled by a set of n distinct positive integer values (whole numbers), arranged in increasing order as w1 = 1 through wn. The problem is: given an amount W, also a positive integer, to find a set of non-negative (positive or zero) integers {x1, x2, ..., xn}, with each xj representing how often the coin with value wj is used, which minimize the total number of coins

subject to

An application of change-making problem can be found in computing the ways one can make a nine dart finish in a game of darts.

A classic dynamic programming strategy works upward by finding the combinations of all smaller values that would sum to the current threshold. Thus, at each threshold, all previous thresholds are potentially considered to work upward to the goal amount W. For this reason, this dynamic programming approach may require a number of steps that is at least quadratic in the goal amount W.

We can use dynamic programming strategy to solve this problem because it exhibits optimal substructure.

Proof.

Suppose is the optimal solution for making coins. Then , for some , is an optimal solution for the subproblem of making coins.


...
Wikipedia

...