A text is made up of the characters A, B, C, D, E each occurring with the probability 0.08, 0.40, 0.25, 0.15 and 0.12 respectively. The optimal coding will have the average length of
$A - 1110$
$B - 0$
$C - 10$
$D - 110$
$E - 1111$
Avg length = $ 4 * (0.08) + 1*(0.4) + 2*(0.25) + 3*(0.15) + 4*(0.12)$ = 2.15
64.3k questions
77.9k answers
244k comments
80.0k users