Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #13101

Re: recursive algorithm for balls in numbered boxes

References <32440187.post@talk.nabble.com>
Date 2011-09-10 19:18 -0700
Subject Re: recursive algorithm for balls in numbered boxes
From Chris Rebert <clp2@rebertia.com>
Newsgroups comp.lang.python
Message-ID <mailman.963.1315707530.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, Sep 10, 2011 at 5:43 PM, Dr. Phillip M. Feldman
<Phillip.M.Feldman@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: recursive algorithm for balls in numbered boxes Chris Rebert <clp2@rebertia.com> - 2011-09-10 19:18 -0700

csiph-web