Coder Profile - Show off your skills, get a coder profile.
 
 
 
The Author
Cinjection
Oleksi Derkatch
Send A Message
Rating
Not
Rated
Please login to rate source codes.

Click here to register a free account with us.
General Details
Ruby
Posted 3.45 Years Ago
1,002 Views
Received 0 Ratings
More Codes By This Author
Wordsearch generator.
Linked List in C#
Julia Set
Mandelbrot Set Generator
MD5 Brute-Forcer
Articles By This Author
Intorduction to memoizati...
Strings in C++
Vectors in C++
Use Cases
[C++] Pointers and their...

Number of ways to make change using Memoization


Description
This is a program I made to solve the following challenge:
"Given the a list of coin amounts, and a final amount, your program should calculate how many different ways there are to make change for the final amount using the various coins.

Your program should input:
1) The final sum
2) The number of different coins
3) The various coins

You can gather this information in any way you want.

There should always be a 0.01 coin to ensure all possible amounts can be changed. Therefore, there should always be at least one kind of coin."
http://www.newgrounds.com/bbs/topic/959858


This particular solution uses memorization(remembering previous calculations for when you need them) to calculate the result fairly quickly.
Technical
Sample run:
Amount to change: 1.00
Number of coins: 5
Coin 1: 0.01
Coin 2: 0.05
Coin 3: 0.10
Coin 4: 0.25
Coin 5: 0.50
There are 292 different ways to make change for $1.0
Source Code
Comments
Please login to post comments.
Page 1 of 1
More "Ruby" Source Codes By This Author
Recently Posted "Ruby" Source Codes
Recently Rated "Ruby" Source Codes
 
 
Latest News About Coder Profile
Coder Profile Poll
Why do you get bored with programming?

Not enough time to do something productive
I run out of ideas
Too hard to show people my creations
Everything i do has too many errors, and it's too hard
I don't get bored!!!


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
3.20 Years Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2012, Scott Thompson, All Rights Reserved