Runs
Suppose I have a biased coin which comes up heads with probability p, and I flip it n times. A runis a sequence of coin flips all of the same type. which is not contained in any longer sequence of coinflips all of the same type. For example. the sequence "HHHTHH" has three nuns: "HHH," "T," and "H."
Compute the expected number of runs in a sequence of n flips.