A given non-decreasing sequence can be represented by a sequence of I's and U's, where I represents the placement of an integer and U represents going up by 1 unit in value as the current value to be placed at any given I. Any U's that occur before the first I increase the value of the first integer. If the last integer is lower than n, then the remaining U's occur after the last I.
Thus there are n U's to take the values from 0 to n, and n+1 I's as there are n+1 integers. The number of such sequences of U's and I's is C(2n+1,n). In the sample case, where n=2, this is C(5,2) = 10, and the correspondence of the two types of sequence is shown:
Posted by Charlie
on 2010-05-04 17:32:31