Abinash's blog

By Abinash, history, 6 years ago, In English

Suppose we want to fill one array A (which has M elements) such that the sum of the numbers is X.

X=A[1]+A[2]+A[3]....A[m] where A[i] is a non-negative numbers. The number of ways to fill this row can be obtained using a combinatorics formulae: (X+M-1) C (X-1).

Can anyone explain ? Thanks in advance.

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Abinash (previous revision, new revision, compare).

»
6 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

It's called ball and urns principle.You can read about it here(https://en.wikipedia.org/wiki/Stars_and_bars_(combinatorics)). And if you want question on this topic i can recommend you some :)