Number of k consecutive 1's subsequences in a binary string.

260 Views Asked by At

Say a sequence $\{X_1, X_2,\ldots ,X_n\}$ is given, where $X_p$ is either one or zero ($0 < p < n$) with probability $\frac{1}{2}$ each. Let $N_k$ be the number of consecutive 1's subsequences of length k in $\{X_1, X_2,\ldots ,X_n\}$,what is $\Bbb E[N_k]$?

Example: in the sequence $1110011$ we have $N_2=3.$

1

There are 1 best solutions below

1
On BEST ANSWER

$N_k=\sum_{i=1}^{n-k+1}X_iX_{i+1}\ldots X_{i+k-1}.$ Hence $E(N_k)=E(\sum_{i=1}^{n-k+1}X_iX_{i+1}\ldots X_{i+k-1})=(n-k+1)E(X_1,X_2\ldots X_k)=\frac{n-k+1}{2^k}$ if we have independence among $X_i$'s.