soln_ex2_makeup

# soln_ex2_makeup - ECE320 Solutions to Makeup Second...

This preview shows pages 1–2. Sign up to view the full content.

ECE320 Solutions to Makeup Second Examination Spring 2006 Cornell University T.L.Fine 1. Consider a source with ﬁve symbols [a,b,c,d,e] having correspond- ing probabilities of being chosen of p = [1 , 1 , 2 , 4 , 8] / 16. Consider a preﬁx code for this set of symbols with the corresponding codewords being [0000 , 0001 , 001 , 01 , 1]. (a)(2pts) What is the expected codeword length? EL = X i l i p i = (4 + 4 + 2 · 3 + 4 · 2 + 1 · 8) / 16 = 15 8 . (b)(3pts) Calculate the source entropy H in bits. In this case, all the probabilities are powers of 1 / 2 and therefore we can exactly evaluate logarithms to base 2, H = - X i p i log 2 ( p i ) = (1 · 4 + 1 · 4 + 2 · 3 + 4 · 2 + 8 · 1) / 16 = 15 8 . (c)(4pts) Construct a Huﬀman code for this source, evaluate its expected length, and compare it to the entropy found in (b). The code given in (a) is a preﬁx code whose expected length equals the source entropy. Hence, it is as short as is possible. The code of (a) is a Huﬀman code, although such codes are not unique. (d)(6pts) Consider another set of codewords [00 , 01 , 10 , 11 , 1] for the sym- bols listed in (a). Evaluate the expected codeword length and compare it to the expected length found in (c). Comment on the comparison. EL

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

soln_ex2_makeup - ECE320 Solutions to Makeup Second...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online