All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Intuitive Coins (Posted on 2005-03-29) Difficulty: 3 of 5
If you must pay an amount in coins, the "intuitive" algorithm is: pay as much as possible with the largest denomination coin, and then go on to pay the rest with the other coins. For example, if there are 25, 5 and 1 cent coins, to pay someone 32 cents, you'd first give him a 25 cents coin, then one 5 cent coin, and finally two 1 cent coins.)

However, this doesn't always end paying with as few coins as possible: if we had 25, 10 and 1 cent coins, paying 32 cents with the "intuitive" algorithm would use 8 coins, while three 10 cent coins and two 1 cent coins would be better.

We can call a set "intuitive", if the "intuitive algorithm" always pays out any amount with as few coins as possible.

The problem: give an algorithm that allows you to decide that {25,5,1} is an "intuitive" set, while {25,10,1} isn't.

  Submitted by Federico Kereki    
Rating: 3.8000 (5 votes)
Solution: (Hide)
For sets with three coins ({1,c,d} with c<d) Kozen and Zaks prove that the set isn't intuitive (canonical) if and only if d=qc+r (0≤c<r) and 0<r<c-q. This test proves {1,5,25} is intuitive, but {1,10,25} isn't.

For the general problem, there's no easy answer. A sufficient (but not necessary condition) is that if each coin is a multiple of the next smallest, the set is intuitive; a special case is any set {1, p, p², p³...}.

A group of interesting references is http://mathforum.org/kb/message.jspa?messageID=138837&tstart=0 and solutions can be found at www.cs.cornell.edu/kozen/papers/change.ps and http://citeseer.ist.psu.edu/pearson94polynomialtime.html

Comments: ( You must be logged in to post comments.)
  Subject Author Date
inefficient but foolproofsteve2005-04-08 04:07:31
re: On the right trackarmando2005-04-02 22:25:23
On the right trackSteve Herman2005-04-02 14:49:14
ideaarmando2005-04-02 09:32:01
Solutionre(3): There's more to it.... (solution? spoiler?) -- larger setsCharlie2005-03-31 14:18:05
re(2): There's more to it.... (solution? spoiler?) -- larger setsCharlie2005-03-31 13:08:57
Solutionre: There's more to it.... (solution? spoiler?) -- larger setsCharlie2005-03-30 19:40:13
SolutionThere's more to it.... (solution? spoiler?)Erik O.2005-03-30 15:47:52
intuitive enougharmando2005-03-30 13:21:39
re: quick thoughtAvin2005-03-30 13:19:37
quick thoughtLarry2005-03-30 12:49:24
re(2): IdeasSteve Herman2005-03-29 22:39:55
re: IdeasJohn2005-03-29 20:58:14
IdeasGamer2005-03-29 19:39:11
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information