Past exam of the communication Theory course of the University of Oxford 2011 2 c Solution 2026-10-31
Let and let be the probability cell of symbol . Its midpoint is . Use the binary expansion terminating in zeros at a dyadic rational, so truncation to bits givesThe chosen codeword corresponds to the dyadic interval . It contains , and its width satisfies . ConsequentlyThus . The probability cells are disjoint, so the code intervals are disjoint. If one binary codeword were a prefix of another, its dyadic interval would contain the other's interval, contradicting this disjointness. Hence the code is instantaneous.
Finally, . Multiplying by and summing yieldsThis is the Shannon-Fano-Elias code: the extra bit makes the dyadic interval narrow enough to remain inside the cell around its midpoint.
Shannon-Fano-Elias code 2026-10-31
For positive source probabilities in a fixed order, let and . The Shannon-Fano-Elias code uses the first binary digits of the midpoint , using the terminating-zero expansion at dyadic rationals. Its dyadic interval contains and has width at most , so it lies inside the probability cell . These cells are disjoint, whereas a codeword that is a prefix of another has a dyadic interval containing the other interval. The code is therefore a prefix code. Since , averaging proves . This is a direct cumulative construction and does not require sorting the probabilities or constructing a Huffman tree.
