recursive algorithm for balls in numbered boxes

Chris Rebert clp2 at rebertia.com
Sat Sep 10 22:18:47 EDT 2011


On Sat, Sep 10, 2011 at 5:43 PM, Dr. Phillip M. Feldman
<Phillip.M.Feldman at gmail.com> 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 and appears to work, but isn't terribly
> elegant.  Any suggestions about how to improve it will be appreciated.

Significantly refactored (but untested) version:
https://gist.github.com/1209079

Cheers,
Chris
--
http://rebertia.com



More information about the Python-list mailing list