Solution
= Solution
A binary <prefix code> assigns each source symbol a distinct finite binary word, with no assigned word a prefix of another. It is instantaneous because a decoder can identify the symbol as soon as its last digit arrives, without reading digits from the next word. Such a code is optimal when it minimizes
$$
\bar\ell=\sum_xp_x|c(x)|
$$
among all binary prefix codes for that source distribution. Symbols of zero probability may be removed from the optimization.