Skip to content
← Back to glossary

ハフマン法Huffman coding

Learn in the textbookData Compression Methods and Characteristics

DefinitionHuffman coding (ハフマン法) is a lossless compression technique that reduces the total data size by giving shorter codes to values that appear more often and longer codes to values that appear less often.

ExplanationA code (符号) is the sequence of 0s and 1s assigned to represent a value. Compared with a scheme that gives every value a code of the same length, the total gets shorter the more uneven the frequencies are. In the example in the figure, each character takes 1.75 bits on average, fewer than the 2 bits needed when every character gets a code of the same length.

AnalogyIt is like putting the people you call most often on the shortest speed-dial numbers.

Memory hookIn Morse code, E, the most common letter in English, is a single dot. It is the same idea: the more often something appears, the shorter its code.