18 February 2014
You have up to 25 minutes. You may use a standard calculator if necessary, but no text book or notes.
Below is a tree representing a variable-width encoding of 9 letters. Use it to:
111110100101
into a word: HINT
WITH
as bits: 100110101111
Decode the following 8×8 image indicated by the hexadecimal number along the right side, which uses 1 bit per pixel.
If an image uses 5 bits for each pixel, what is the maximum number of distinct colors it can contain?
2⁵ = 32 colors
Draw a tree representing a variable-width encoding of the four letters M, I, S, and P. Use it to encode the word MISSISSIPPI
. The fixed-width tree (below) uses exactly 2 bits per character, so encoding MISSISSIPPI
requires 22 bits. How many bits does your tree need to encode MISSISSIPPI
?
Here is one possible solution. In this tree, M and P are extended to 3 bits each, so that S (or equivalently, I) can be just 1 bit. We can then encode MISSISSIPPI as 21 bits.