Data compression by assigning binary codes to characters.

For example, consider a 100,000 character file with only six different characters: a, b, c, d, e, f.

a | b | c | d | e | f | ||

Frequency | 45k | 13k | 12k | 16k | 9k | 5k | |

Fixed-Length Code | 000 | 001 | 010 | 011 | 100 | 101 | 300,000 bits |

Variable-Length Code | O | 101 | 100 | 111 | 1101 | 1100 | 224,000 bits |

(optimal) |

Huffman's algorithm determines optimal variable-length code (Huffman Codes).