This is an old version, saved 4 Dec 2026, 12:36 by TechWritereditor. See the current version.

Huffman coding

Huffman coding is a method of lossless data compression that builds a variable-length code from how often each character or symbol appears, so that frequent symbols get short codes and rare symbols get long ones.[1] The 1952 paper describing it is one of the most-cited papers in information theory.[2]

Contents
  1. History
  2. How it works
  3. Uses
  4. See also
  5. References

History

In 1951 David A. Huffman was a graduate student on an electrical engineering course at the Massachusetts Institute of Technology taught by Robert Fano. Fano let students choose between sitting a final exam and writing a term paper; Huffman chose the paper, whose topic was finding the most efficient code. Fano had not told the class that this was an unsolved problem, and his own method did not always produce the best possible code.[3] Huffman's solution always produced a code with the lowest possible average message length.[3] He published it in September 1952 as "A Method for the Construction of Minimum-Redundancy Codes" in the Proceedings of the IRE.[1][3]

How it works

The encoder first counts how often each symbol occurs. Each symbol becomes a one-node tree whose weight is its frequency. The two lightest trees are repeatedly joined under a new parent whose weight is the sum of the two, until a single tree remains.[1][2] Reading the path from the root to each symbol, one bit per level, gives that symbol's code: common symbols sit near the root and get short codes, while rare symbols sit deeper and get longer ones.[1] Because no code is the beginning of another code (a "prefix code"), a decoder can read the bit stream without separators.[1] A compressed file must also carry a description of the tree so that the decoder can rebuild it.[2]

Huffman coding is optimal when each symbol is given its own whole-bit code word. Arithmetic coding can compress further by using fractions of a bit, at the cost of more complexity.[1] Variants include adaptive Huffman coding, which updates the tree as data arrives.[1]

Uses

Huffman coding became widely used for compressing and transmitting data in Fax machines, Modems, computer networks and high-definition television.[4] It can be applied to text, images, music and video, provided the common items in the data are identified and given short bit sequences.[2]

See also

References

  1. ^ huffman coding. National Institute of Standards and Technology (Dictionary of Algorithms and Data Structures). xlinux.nist.gov
  2. ^ Huffman Coding (CS106B background). Stanford University. web.stanford.edu
  3. ^ Discovery of Huffman codes. New Mexico State University (Inna Pivkina). cs.nmsu.edu
  4. ^ UC Santa Cruz mourns the death of David Huffman. University of California, Santa Cruz. 1999-10-14. www1.ucsc.edu