next up previous
Next: Up: Previous:

Prefix Codes

In a prefix code, no code is a prefix of another code.

Why?



1.
Any optimal character code has an equally optimal prefix code.
2.
Easy encoding and decoding.
``abc'' $\longrightarrow$ 0.101.100
Once a string of bits matches a character code, output that character with no ambiguity (no need to look ahead).

Use a binary tree for decoding.



\psfig{figure=figures/f9-1.ps,width=4in,height=2in}


next up previous
Next: Up: Previous: