How to calculate expected code length?

869 Views Asked by At

enter image description here

enter image description here

How to calculate expected code length?

1

There are 1 best solutions below

0
On BEST ANSWER

enter image description here

Should be: $$L = \sum p_i l_i = (0.25 + 0.25 + 0.2) \times 2 + (0.15 + 0.15) \times 3 = 2.3 $$