[ale] a math/cs question

joh6nn joh6nn at joh6nn.com
Thu Apr 17 22:42:28 EDT 2008


Actually Jerry, IANAMathematician, but i'm fairly sure that the problem 
as you've stated it is unsolvable.  I don't see a way to answer the 
"fewest buckets" question without knowing the specific size of the 
buckets in question.  otherwise, if all you know is your buckets are 
somewhere between 500 and 600, the only way to be sure you're not 
over-filling the bucket is to just stop at 500.  but that won't get you 
the *best* solution, that'll only get you *a* solution.

of course, having failed calculus 3 times, there's a pretty good chance 
i'm just plain wrong. either way, posting the problem as stated will 
still be helpful. ;)

-joh6nn

Greg Freemyer wrote:
> Jerry,
> 
> The number of bags is more important than you are giving it credit for.
> 
> If only 5 bags, then 5 factorial is 120, so there are only 120 ways
> you can order the bags.  With that few, you could just try every
> possible ordering of the bags, then simply place them into the buckets
> one at a time.  If a bag won't fit, move to the next bucket.  Then
> record the buckets needed for each of the 120 possibilities and pick
> the smallest answer.
> 
> You should be able to code that up pretty quick and it would not waste
> too much cpu time.
> 
> OTOH, 20 factorial is 2.4 * 10^18 (if I read
> http://en.wikipedia.org/wiki/Factorial correctly).
> 
> For that you really do need to have an algorithm that is smarter about
> the process of putting bags into buckets.
> 
> Greg
> 
> 2008/4/17 Jerry Yu <jjj863 at gmail.com>:
>> Given a varying # of bags, each containing a varying # of  golf balls.
>> what's the best/practical algorithm to sort these bags to the fewest
>> buckets. The buckets can hold varying # of golf balls. assume bags don't
>> consume space.
>>  If the actual # matters,   assume  5~20 bags, 10~500 balls per bag, 500~600
>> balls per bucket.
>>
>> I thought some one  else on the list asked for similar things for  backup
>> grouping. couldn't find in my own ALE archive in gmail :(

> 



More information about the Ale mailing list