As Introduction to Algorithms (CLRS) describes, the problem is
Suppose you flip a fair coin $n$ times. What is the longest streak of consecutive heads that you expect to see?
The book claims that the expects is $\Theta(\log{}n)$, and proves that it is both $O(\log{}n)$ and $\Omega(\log{}n)$. I want generize the problem, and look into the $\Theta(\log{}n)$.
For example, we're flipping a biased coin with the probability $p$ for head and $q$ for tail, where $p+q=1$. Supposing that the length of the longest streak is $X$, we want to rewrite $EX = A\log{}n + O(1)$, or more precisely, $EX = A\log{}n + B + o(1)$, or something else. How to determine the asymptotics for $EX$?
There's something trivial. Supposing that $P_{n,m}=\textrm{ probability that }X<m$, we have $P_{n,m}=qP_{n-1,m}+pqP_{n-2,m}+\cdots+p^{m-1}qP_{n-m,m}$ for $n \ge m$, and $P_{n,m}=1$ for $n<m$, thus $P_{n,m}$ could be solved out (linear difference equation), but there might be no useful formulas to determine the roots of $1-z-\cdots-z^m=0$ where $m>0$.
Any help? Thanks!