Clarification on expected number of coin tosses for specific outcomes. As seen in this question, André Nicolas provides a solution for 5 heads in a row.
Basically, for any sort of problem that relies on determining this sort of probability, if the chance of each event is 50/50, then no matter what the composition of values, the linear equation would be the same?
For example, in the case of flipping 5 coins, and wanting to find out how many flips are needed for 4 consecutive tails followed by a head, is the same form as trying to find how many flips for 5 heads? 
specifically:
$$x=\frac{1}{2}(x+1)+\frac{1}{4}(x+2)+\frac{1}{8}(x+3)+\frac{1}{16}(x+4)+\frac{1}{32}(x+5)+\frac{1}{32}(5).$$
Where $\frac{1}{32}(x+5)$ denotes the last flips chance of landing a tails after 4 heads in a row (.5*.5*.5*.5*(P(tails))
If I was using an unfair coin in the same example as above (HHHHT) with a 60% chance to land on heads, would the equation be:
$$x=\frac{1}{2}(x+1)+\frac{1}{4}(x+2)+\frac{1}{8}(x+3)+\frac{1}{16}(x+4)+\frac{1}{40}(x+5)+\frac{1}{40}(5).$$
 A: No, it is not the same.  For this pattern, the argument holds well (if you keep flipping heads) until four tosses.  But on the fifth toss, if you flip heads you are done, but if you flip tails you are not back to the start-you have potentially flipped the first of your winning series.  You will need to consider states where you have flipped some number of tails so far.
For the unfair coin problem, aside from that objection, the $\frac 12$ would become $\frac 25$ for the first one because you have a $40\%$ chance to land tails and be back at start.  Again, the first four flips work fine (with $0.4^n$) but you need to worry about states with one or more heads in the bank.
A: Suppose that the probability of head is $p$, and the probability of tail is $1-p$, where $0\lt p\lt 1$.   
Let $x$ be the expected number of tosses until we first get the sequence HHHHT.  As in the solution in the previous problem, we will obtain a linear equation for $x$. 
If the first toss is T, (probability $1-p$) our expectation is $1+x$. That contributes $(1-p)(1+x)$ to the mean.
Similarly, first two tosses HT contributes $p(1-p)(2+x)$ to the mean, and HHT contributes $p^2(1-p)(3+x)$, and HHHT contributes $p^3(1-p)(4+x)$. Of course HHHHT  contributes $p^4(1-p)(5)$. 
But computing the contribution of HHHHH involves an additional idea.   
For HHHHH, the contribution is $p^5 (5+w)$ where $w$ is the mean waiting time for a tail. That is a standard problem (mean of a geometric distribution) and we have $w=\frac{1}{1-p}$.
Alternately, we can forget about HHHHT, and HHHHH, and note that HHHH contributes $p^4(4+w)$ to the mean. 
Remark: For more general problems of this character, it is easier to set up an appropriate set of states $s_1, s_2,\dots, s_n$ and let $e_1,e_2,\dots,e_n$ be the expected (further) costs when we are in the various states. We can fairly often reduce the problem to solving a set of linear equations in the $e_i$. 
