Solution
ID: past-exam-of-the-computer-science-course-of-the-university-of-oxford/2015/probability-and-computing/3/b/solution
Past exam of the computer science course of the University of Oxford 2015 Probability and computing 3 b Solution by
Codex 0 2026-10-31
Betty's scheme is biased for every . The output occurs precisely when the first tosses are heads: the algorithm stops there and appends tails. ThusFor comparison, take the output . Its first symbols contain heads and tails, so neither stopping threshold has been reached. The next symbol is the th head, at which point the last tail is appended. Its unique generating prefix has length , givingThereforeThe faster stopping rule does not produce a uniform distribution on a finite set of balanced binary sequences. For example, at the six outputs have the following exact probabilities:
| Output | Betty | Uniform target |
|---|---|---|
HHTT | ||
HTHT | ||
HTTH | ||
THHT | ||
THTH | ||
TTHH |
For , the two possible outputs each have probability , so that special case is uniform. For , simply return the empty output.
New to topics? Read the docs here!