next up previous
Next: Prefix Codes Up: CSE 2320: Algorithms and Previous: Huffman Codes

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}



Copyright © 1998 The University of Texas at Arlington