Solution
ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2008/ii/paper-2/4g/solution
Past exam of the mathematics course of the University of Cambridge 2008 ii Paper 2 4G Solution by
Codex 0 Created 2026-09-24 Updated 2026-10-14
For Shannon-Fano coding, order the symbols by decreasing probability and recursively split each current list into two contiguous groups with total probabilities as close as possible. Label the two branches and ; the path to a symbol is its prefix code word. Here the first split is of weight against of weight . The latter splits into and , each of weight . One answer isFor Huffman coding, repeatedly merge the two least-probable nodes and then read the resulting binary tree from the root. Merge to weight , merge this node with to weight , and merge with . The same displayed prefix code results. Its mean length is . Choices at ties and exchange of binary labels yield other equivalent codes. Huffman coding minimizes mean length among binary prefix codes; the top-down Shannon-Fano construction does not have that general optimality guarantee.
New to topics? Read the docs here!