Past exam of the mathematics course of the University of Cambridge 2021 iii Paper 224 4 c Solution 2026-09-28
Relabel the symbols so and assign all finite binary strings in nondecreasing length order, beginning with the empty string. The th string has lengthSince ,Thus the optimal one-to-one binary code satisfies
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 224 4 c i Solution Created 2026-09-24 Updated 2026-09-25
For any fixed threshold , minimizing the excess-length probability means assigning the available strings shorter than to the most probable symbols. Repeating this exchange argument simultaneously for every threshold orders symbols by decreasing probability and assigns binary strings from shortest to longest. There are words of length , so the th word in shortlex order has lengthThis is the optimal one-to-one binary code.
Past exam of the mathematics course of the University of Cambridge 2026 iii Paper 224 4 b Solution Created 2026-09-24 Updated 2026-09-25
Order the symbols so that . For each , there are exactly binary strings of length , while precisely the indicessatisfy . Assign those symbols bijectively to the strings of length . The resulting map is an injective function and hence a one-to-one source code, with . Assigning shorter available words to more probable symbols also shows that this is an optimal one-to-one binary code.