written 2.0 years ago by |
Solution:
Reorder in descending order:
Average cade length = E no.ot bits for each symbol $\times$ its probability.
$ \begin{aligned}\\ =& 2(0.22)+2(0.22)+2(0.22)+3(0.11) \\\\ &+4(0.11)+4(0.11) \\\\ =& 0.44+0.44+0.44+0.33+0.44+0.44 \\\\ =& 2.53 \text { blts } \end{aligned} $
Average code length $=2.53 \mathrm{bits} /$ symbol
$ \begin{aligned}\\ H=-& \sum p_i \log _2 p_i \\\\ =-&\left(0.22 \log _2 0.22+0.22 \log _2 0.22\right.\\\\ &+0.22 \log _2 0.22+0.11 \log _2 0.11 \\\\ &\left.+0.11 \log _2 0.11\right)\\ \end{aligned}\\ $
$ \begin{aligned} =&-(-0.48056-0.48056-0.480 .56\\\\ &-0.3802-0.3502) \\\\ =& 2.142164\\ \end{aligned}\\ $
$ \text { Coding efficiency }=\frac{\text { Entropy }}{\text { Average code length }}\\ $
$ \begin{aligned} &=\frac{2.142164}{2.53} \\\\ &=0.846705 \\\\ &=84.67 \%\\ \end{aligned}\\ $