Optimal one-to-one binary code
= Optimal one-to-one binary code
Order source symbols by decreasing probability and assign the $i$th symbol a binary word of length $\lfloor\log_2i\rfloor$. This minimizes expected length among one-to-one binary codes because the available shortest words are assigned to the most probable symbols.