Wed Feb 10
You have up to 20 minutes. You may use a standard calculator if necessary, but no text book or notes.
+5 Convert the following 5-bit signed two’s complement binary numbers into base ten.
+5 Below is a tree representing a variable-width encoding of 9 letters. Use it to:
10011111010011010
into a word: WHINE
WITH
as bits: 100110101111
+5 If an image uses 9 bits for each pixel, what is the maximum number of distinct colors it can contain?
\(2^9 = 512\) colors. Note this has little to do with color; when you want to represent anything in 9 bits, there are \(2^9\) possible things. Could be characters, numbers, student IDs, etc.
+5 Draw a tree representing a variable-width encoding of the four letters A, L, N, and T. Use it to encode the word ATLANTA
. The fixed-width tree (below) uses exactly 2 bits per character, so encoding ATLANTA
requires 14 bits. How many bits does your tree need to encode ATLANTA
?
Here is one possible solution. In this tree, L and N are extended to 3 bits each, so that A can be just 1 bit. We can then encode ATLANTA as 13 bits.