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


Groups > comp.lang.python > #13094

recursive algorithm for balls in numbered boxes

Date 2011-09-10 17:43 -0700
From "Dr. Phillip M. Feldman" <Phillip.M.Feldman@gmail.com>
Subject recursive algorithm for balls in numbered boxes
Newsgroups comp.lang.python
Message-ID <mailman.959.1315701829.27778.python-list@python.org> (permalink)

Show all headers | View raw


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.

Also, I'd like to get this functionality into the Python's `itertools`
module (the present set of combinatorics functions in `itertools` does not
include "balls in boxes").  Does anyone know whom I should contact about
this?

Phillip

http://old.nabble.com/file/p32440187/balls_in_numbered_boxes.py
balls_in_numbered_boxes.py 
-- 
View this message in context: http://old.nabble.com/recursive-algorithm-for-balls-in-numbered-boxes-tp32440187p32440187.html
Sent from the Python - python-list mailing list archive at Nabble.com.

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


Thread

recursive algorithm for balls in numbered boxes "Dr. Phillip M. Feldman" <Phillip.M.Feldman@gmail.com> - 2011-09-10 17:43 -0700
  Re: recursive algorithm for balls in numbered boxes Mark Dickinson <mdickinson@enthought.com> - 2011-09-11 08:08 -0700
    Re: recursive algorithm for balls in numbered boxes "Dr. Phillip M. Feldman" <Phillip.M.Feldman@gmail.com> - 2011-09-12 08:47 -0700

csiph-web