CS254
Chris Pollett
Nov. 21, 2011
Definition. A probabilistic Turing machine (PTM) is a TM with two transition functions `delta_0`, `delta_1`. To execute a PTM `M` on input `x`, we choose in each step with probability `1/2` to apply `delta_0` or to apply `delta_1`.
The machine only outputs `1` (Accept) or `0` (Reject). We denote by `M(x)` the random variable corresponding to the value `M` writes at the end of the process. For a function `T: NN -> NN`, we say that `M` runs in time `T(n)` if for any input `x`, `M` halts on `x` within `T(|x|)` steps regardless of the choices `M` makes.
Which of the following is known to be true?
Claim. For every input `k, a_1, ..., a_n` to FindKthElement, let `T(k, a_1, ..., a_n)` be the expected number of steps the algorithm takes on this input. Let `T(n)` be the maximum of `T(k, a_1, ..., a_n)` over all length `n` inputs. Then `T(n) = O(n)`.
Proof. We can prove by induction that `T(n) < 10cn`. Fix some inputs `k, a_1, ..., a_n`. For every `j in [n]` we choose `x` to be the `j`th smallest of `a_1, ..., a_n` with probability `1/n`, and then we perform either at most `T(j)` steps or `T(n-j)` steps. Thus, we have:
`T(k, a_1, ..., a_n) le cn + 1/n(sum_(j>k)T(j) + sum_(j < k)T(n-j))`
Plugging in our induction hypothesis that `T(j) le 10cj` for `j < n`, gives
`T(k, a_1, ..., a_n) le cn + 10 frac(c)(n)(sum_(j>k) j + sum_(j < k)(n-j)) le cn +10 frac(c)(n)(sum_(j > k) j +kn - sum_(j < k) j)`
Next using `sum_(j > k) j le (n(n-k))/2` and `sum_(j < k)j ge frac(k^2)(2)(1 - o(1)) ge k^2/2.5`, we get
`T(k, a_1, ..., a_n) le cn + 10 frac(c)(n)((n(n-k))/2 +kn - k^2/2.5) = cn + 10 frac(c)(n)(n^2/2 + (kn)/2 - k^2/2.5)
Considering separately the cases `k < n/2` and `k> n/2` we can see this last equation is always less than
`cn + (10c)/n (9n^2)/10 = 10cn`.