recursive algorithm for balls in numbered boxes

Dr. Phillip M. Feldman Phillip.M.Feldman at gmail.com
Sat Sep 10 20:43:39 EDT 2011


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.




More information about the Python-list mailing list