Huffman Coding
Huffman Coding
is a beautifully simple variable-length
entropy coding
method used
in lossless data compression.
It works by replacing fixed-length
symbols (for example, 8-bit
bytes) by variable-length
codes.
These codes can be shorter or longer than the original symbols
(hence why they are called variable-length).
The symbols that occur more often will be represented by small codes with fewer bits, and the symbols that rarely appear will be represented by longer codes with potentially more bits than the original symbol itself.
This way, the resulting encoded bitstream should be smaller than the original bitstream, while not losing any information (it is a lossless process).