Assignment 1A Solution

# In particular for any is a prex of however we can

This preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: 8©V¥£ p h  ¦ e PH W vuQIF  `  h ¦  ¡£ ( c £ GQ` W§ 7¥)wU )( h e 9 ' e PH QIF e ' p f t   ¦  ¡£ GQt  1¥6( ¦¨ 8©¦ £ p while the unconditional entropy is ¦  ¡£ ( ¦ 2!¥) 6( £ Therefore, knowing the previous character reduces entropy by a factor of f ¨ C©¦ £ ¢ fec' ¦  ¨ ¤gGWd&28¦ It follows that and ech ¦ " WiT%B&¦ by using the equations Problem 2 The unary code ( ) is uniquely decipherable but not preﬁx-free. In particular, for any , is a preﬁx of . However, we can easily decipher the code by counting the number of zeros between two consecutive ones. £   5x 6u  £ GIx   h ¦ £ QB§5yx 1 Problem 3 We have  ¤¨ ¥©¡ tb¦hbh`b  Wd§GiWaWe &¦ ¤¢ ¥£¡ h hh   BQh BQQh QBh   We decode the sequence using the following procedure: x=0.3076171875; // the message in decimal format\ low=0; // initial lower interval bound high=1; // initial upper interval bound n=4; // the number of characters in the code while (n>0) do // repeatedly narrow the interval around x { determine which of the following intervals contains x: (1): [low, 9/10*low+1/10*high), (2): [9/10*low+1/10*high, 7/10*low+3/10*high), (3): [7/10*low+3/10*high, high) ; output a,b,c for intervals (1),(2),(3) respectively; low=low boundary of the interval containing x; high=high boundary of the interval containing x; n--; } We implement this idea in Mathematica: Clear[Code] (* executes one step of the coding *) Code[low_, high_, x_] := {a, low, 9/10*low + 1/10*high} /; x &...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online