Back

Question: 2017 Winter Final - 22

Author: Michiel Smid
Consider the following recursive algorithm $\TwoTails$, which takes as input a positive integer $k$:
$\mathbf{Algorithm}\ \TwoTails(k)\mathrm{:}$
$//$ $\text{all coin flips made are mutually}$ $\text{independent}$
$\text{flip a fair coin twice};$
$\mathbf{if}\ \text{the coin came up heads exactly twice}$
$\mathbf{then}\ \mathrm{return}\ 2^k$
$\mathbf{else}\ \TwoTails(k + 1)$
$\mathbf{endif}$
You run algorithm $\TwoTails(1)$, i.e., with $k = 1$. Define the random variable $X$ to be the value of the output of this algorithm.
Let $m \geq 1$ be an integer. What is $\Pr(X = 2^m)$?
(a)
$(1/4)^{m} \cdot 3/4$
(b)
$(3/4)^{m} \cdot 1/4$
(c)
$(1/4)^{m-1} \cdot 3/4$
(d)
$(3/4)^{m-1} \cdot 1/4$