Mark Dickinson-2 wrote:
>
>
> This is a well-known trick: to divide 5 (unlabeled) balls amongst 3
> (labeled) boxes, you write down sequences of 5 o's and 2 x's, where
> the o's represent the 5 balls and the 'x's represent dividers:
>
> ooxooxo -> [2, 2, 1]
> xoooxoo -> [0, 3, 2]
>
Dr. Phillip M. Feldman wrote:
> When I run my code, I get the same 14 configurations that your code
> produces;
I'm sorry, I ran the buggy code from
http://old.nabble.com/file/p32439307/balls_in_numbered_boxes.py
without realizing it was not
http://old.nabble.com/file/p32440187/balls_in_numb
Chris,
Your code is much cleaner than mine. I will have to figure out exactly how
it is working.
Thanks!
Phillip
--
View this message in context:
http://old.nabble.com/recursive-algorithm-for-balls-in-numbered-boxes-tp32440187p32443579.html
Sent from the Python - python-list mailing list a
Hello Peter,
When I run my code, I get the same 14 configurations that your code
produces; the only different that I can see in the output is that the
configurations are produced in a different order. Note that your code is
not creating an iterator, so thus doesn't do what I want. Also, generat
On Sep 11, 1:43 am, "Dr. Phillip M. Feldman"
wrote:
> I've written a recursive class that creates an iterator to solve a general
> formulation of the combinatorics problem known as "balls in numbered boxes"
> (also known as "indistinguishable balls in distinguishable boxes"). The
> code has been
Dr. Phillip M. Feldman wrote:
> I've written a recursive class that creates an iterator to solve a general
> formulation of the combinatorics problem known as "balls in numbered
> boxes"
> (also known as "indistinguishable balls in distinguishable boxes"). The
> code has been extensively tested a
On Sat, Sep 10, 2011 at 5:43 PM, Dr. Phillip M. Feldman
wrote:
> I've written a recursive class that creates an iterator to solve a general
> formulation of the combinatorics problem known as "balls in numbered boxes"
> (also known as "indistinguishable balls in distinguishable boxes"). The
> cod