0
$\begingroup$

Similar questions have been asked before, however in this case each of the bins may each have a different capacity. Example: There are $2$ possibilities to put $7$ objects into two bins of the size $5$ and $3$, respectively. Is there a formula that will result in the amount of ways this can be done given the number of objects and the bin sizes?

PS: I've already come up with a way on how to brute force this by simply checking all possible combinations and counting the valid ones. I was just wondering if there was an easier way to approach this.

$\endgroup$
3
  • $\begingroup$ My answer to this question gives a complete solution to a concrete numerical problem in which the sizes are all the same. My answer to this question shows what modifications are necessary when the sizes are not all the same. $\endgroup$ Oct 4, 2015 at 17:42
  • $\begingroup$ Too bad there's no way to upvote a comment, you pointed me on the right track and I managed to solve the problem. $\endgroup$
    – LeoTietz
    Oct 12, 2015 at 13:32
  • $\begingroup$ @LeoTietz I have the same problem - did you find a closed formula solution for the general problem? If so do you mind sharing it? $\endgroup$
    – smörkex
    Dec 11, 2016 at 20:11

1 Answer 1

0
$\begingroup$

X1 + X2 + X3 ...... + Xk= n (Where Xi is number of objects in the ith bin ) We need to find the number of non negative integral solutions of this equation . Which is (n+k-1)C(k-1)

$\endgroup$
3
  • $\begingroup$ Sorry if this sounds dumb, but could you provide an example for how to use this (maybe using the example in my post)? $\endgroup$
    – LeoTietz
    Oct 4, 2015 at 15:50
  • $\begingroup$ Yeah sure . Say you are given 10 identical balls and you have to put them in 3 identical bins . So you can apply (n+k-1)C(k-1) where n= 10 k=3 so we'll get 12C2 $\endgroup$
    – Tejus
    Oct 4, 2015 at 15:54
  • $\begingroup$ How would it work for my example? (7 objects, 2 bins of size 7 and 3)? $\endgroup$
    – LeoTietz
    Oct 4, 2015 at 15:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .