

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Comp 411 Computer Organization Spring 2007
Problem Set # Issued Tuesday, 1/16/2007; Due Tuesday, 1/23/
Homework Information : Some of the problems are probably too long to be done the night before the due date, so plan accordingly. Late homework will not be accepted. Feel free to get help from others, but the work you hand in should be your own.
Problem 1. โMiss Information?โ
In lecture we learned that information resolves uncertainty, and that information is measured in units of bits. In order to uniquely identify one of N equally likely alternatives, log 2 N bits of information must be communicated. This is equivalent to saying that log 2 N bits are needed to encode any particular choice. If we learn a fact that only narrows down a list of possible alternatives to a choice of M candidates ( M < N ), we say that weโve received log 2 ( N/M ) bits of information. For example, if we start with 4 equally likely alternatives, weโll need 2 bits to provide a unique encoding for each of the 4 alternatives. If we learn a fact that narrows the number of alternatives down to 2, that fact has conveyed log 2 (4/2) = 1 bit of information.
(A) How many bits are required to uniquely encode all playing cards in a standard deck of 52? If you are told a cardโs suit, how many bits of information are conveyed? If you are told that the same card is a face card, how many additional bits are conveyed?
(B) How many total bits of information are in a single deck of cards? If all cards with values 2 to 6 inclusive are removed from the deck (all suits), how many total bits are required to encode the resulting smaller deck? In this smaller deck, how many bits are required to encode the cardโs suit? Itโs face value (7, 8, 9, 10, J, Q, K, or A)?
Consider the situation when the N alternatives are not equally likely. It still takes log 2 N bits to encode any particular choice, but with clever encoding the average number of bits needed to encode a choice might be smaller. For example, suppose there were three alternatives (โAโ, โBโ, and โCโ) with the following probabilities of being chosen:
p(โAโ) = 0. p(โBโ) = 0. p(โCโ) = 0. p(โDโ) = 0.
We might encode โAโ with the string โ0โ, โBโ with โ10โ, โCโ with โ110โ, and โDโ with โ111โ.
(C) If we record the results of making a sequence of choices by concatenating from left-to-right the bit strings that encode each choice, what sequence of choices is represented by the bit string โ0100111110010โ?
(D) What is the expected length of the bit string that encodes the results of making 1000 choices? What is the length in the worst case? How do these numbers compare with 1000*log 2 (4/1)?
Intuitively it seems that we get less information when we learn of a likely choice and more information when we learn of an unlikely choice. This intuition is reflected in the following formula for the average number of bits of information (Entropy) received about a choice made from N alternatives when each alternative has a (possibly different) probability pi :
N
i
=
1
(E) How much information do you receive, on average, from a single flip of a crooked coin where ptail = 0.375 and phead = 0.625? Is this more or less than the amount of information you receive from the flip of a fair coin?
(F) A data stream is composed of a sequence of three characters, { u , d , s }. What probabilities would you assign to these to maximize the entropy? What probabilities would you assign to minimize the entropy? Assume that the probabilities of u, d, and s are p( u ) = 0.7, p( d ) = 0.2, and p( s ) = 0.1. What is the entropy of this data stream? How close can you come to achieving this number of bits in practice? Suppose, that you assign a unique code to every 2- character combination, { uu, ud, us, du, dd, ds, su, sd, ss }. Devise a variable length code to for this data stream, and compute its entropy (you can assume all data streams are composed of an even number of characters). What is the entropy of this data stream? How close can you come to achieving this number of bits in practice?