Number of $\{0,1\}$ vectors with given runs

40 Views Asked by At

What is number of $\{0,1\}^n$ vectors which have $01$ patterns at exactly $k$ coordinates?

1

There are 1 best solutions below

4
On BEST ANSWER

if we start with $0$ then this corresponds to seperating the places into $2k$ or $2k+1$ non empty chunks ( the chunks of consecutive coordinates that are all the same), which by stars and bars can be done in $\binom{n-1}{2k-1}+\binom{n-1}{2k}$ ways.

if we start with $1$ then we have to separate into $2k+1$ or $2k+2$ chunks and we get $\binom{n-1}{2k}+\binom{n-1}{2k+1}$