Question: 1 Shannon code. Consider the following method for generating a code for a random variable x that takes on m values { 1 , 2

1 Shannon code.
Consider the following method for generating a code for a random variable x that takes
on m values {1,2,cdots,m} with probabilities p_(1),p_(2),cdots,p_(m). Assume that the probabilities
are ordered so that p_(1)>=p_(2)>=cdots>=p_(m). Define
F_(i)=\sum_(k=1)^(i-1) p_(k)
the sum of the probabilities of all symbols less than i. Then the codeword for i is the
number F_(i)in[0,1] rounded off to l_(i) bits, where l_(i)=|~log((1)/(p_(i)))~|.
(a) Show that the code constructed by this process is prefix-free and that the average
length satisfies
l_(i)=|~log((1)/(p_(i)))~|log((1)/(p_(i)))=l_(i)=log((1)/(p_(i)))+12^(-l_(i))=p_(i)=2^(-(l_(i)-1)).F_(j)j>iF_(i)2^(-l_(i))F_(j),j>il_(j)>=l_(i)F_(i)l_(i)(0.5,0.25,0.125,0.125)H(x)=L
Hints: Since l_(i)=|~log((1)/(p_(i)))~|, we have log((1)/(p_(i)))=l_(i)=log((1)/(p_(i)))+1 and 2^(-l_(i))=p_(i)=2^(-(l_(i)-1)).F_(j)
for j>i, differs from F_(i) by at least 2^(-l_(i)). The codeword for F_(j),j>i, which has length
l_(j)>=l_(i), differs from the codeword for F_(i) at least once in the first l_(i) places.
(b) Construct the code for the probability distribution (0.5,0.25,0.125,0.125).
1 Shannon code. Consider the following method for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!