Algorithm for change-making problem

  • Thread starter Appledave
  • Start date
  • Tags
    Algorithm
In summary, the article presents an algorithm for determining the use of a greedy algorithm with a set of coins, which involves computing and comparing values until a counterexample is found.
  • #1
Appledave
14
0
Ok, so I found this article that presents an algorithm for deciding whether or not a set of coins allows for use of a greedy algorithm when making change:

http://ecommons.cornell.edu/bitstream/1813/6219/1/94-1433.pdf

But I'm not quite sure if I've understood it. The way I see it you do the following:

-choose i and j
-compute G(ci-1 -1)
-from G(ci-1 -1), find M(w)
-from M(w) find w
-compute G(w)
-if |M(w)| < |G(w)| there is a counterexample and the coin set does not allow for a
greedy algorithm
-repeat for different combinations of i and j until you find a counterexample or until all
combinations have been tried, in which case the coin set allows for use of a greedy
algorithm

does this sound about right?

Copious amounts of thanks in advance :) I realize asking people to read the article is a bit much.
 
Technology news on Phys.org
  • #2
Yes, your explanation is correct. The algorithm presented in the article is a way to determine if a set of coins allows for use of a greedy algorithm when making change. It involves choosing two values, i and j, computing G(ci-1 -1) and M(w), finding w, computing G(w), and then repeating the process until a counterexample is found or all combinations have been tried. If no counterexamples are found, then the coin set allows for use of a greedy algorithm.
 

1. What is the "Algorithm for change-making problem"?

The "Algorithm for change-making problem" is a mathematical approach to finding the most efficient way to make change for a given amount of money. It involves finding the least number of coins and bills needed to make the change, while also minimizing the total value of the coins and bills used.

2. How does the algorithm work?

The algorithm works by starting with the largest denomination of coin or bill and repeatedly subtracting it from the total amount until the remaining amount is less than the denomination. Then, it moves on to the next largest denomination and repeats the process until the total amount is reduced to zero. This results in the minimum number of coins and bills needed to make the change.

3. What makes this algorithm efficient?

This algorithm is efficient because it uses a systematic approach to finding the minimum number of coins and bills needed. It does not involve any guesswork or trial and error, which can be time-consuming and less accurate. Additionally, it takes into account the value of the coins and bills, not just their quantity, to minimize the total value used.

4. Can this algorithm be used for any currency?

Yes, this algorithm can be used for any currency as long as the denominations are known. It can also be adapted to work with different types of coins and bills, such as paper currency or tokens.

5. Are there any limitations to this algorithm?

One limitation of this algorithm is that it only works with a finite set of denominations. In reality, there may be an infinite number of coins and bills that can be used to make change. It also assumes that there is an unlimited amount of each denomination available, which may not always be the case.

Similar threads

  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
1
Views
4K
  • Programming and Computer Science
Replies
11
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Programming and Computer Science
Replies
8
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
1
Views
934
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Back
Top