Click here to Skip to main content
Click here to Skip to main content

Tagged as

The Coin Changing Problem!

, 4 Jan 2010
Rate this:
Please Sign up or sign in to vote.
The coin changing problem is a known problem in the field of algorithms and a famous example in Greedy Algorithms which is one of the good ways for a making a good coin change. The problem states that "given a set of coins with several values, it is required to make a change using those coins...
The coin changing problem is a known problem in the field of algorithms and a famous example in Greedy Algorithms which is one of the good ways for a making a good coin change. The problem states that "given a set of coins with several values, it is required to make a change using those coins for a particular amount of cents using the minimum number of coins".
 
As we mentioned earlier, a greedy algorithm solution is known which is, in fact, how millions of people change money every day. That is, start chaning with the largest coin available until the remaining amount to change is less than the largest coin value, then start changing with the next possible coin(the coin with the lower value). Continue with repeated changing until there are no more cents left to change.
 
Below is the VB.NET implementation of a simple coin changer using the above algorithm: http://www.developersource.net/ArticlePage.aspx?ID=11[^]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Ali Tarhini
Software Developer (Senior) Microgen
Lebanon Lebanon
For more articles and extreme topics please check out my personal website www.alitarhini.com

Comments and Discussions

 
GeneralHi PinmemberAric Green4-Jan-10 4:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 4 Jan 2010
Article Copyright 2010 by Ali Tarhini
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid