Huffman Encoding

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

In run-length encoding, one breaks up the data into runs of identical elements of varying lengths. Huffman encoding in particular breaks the data—in this case, an array of 1's and 0's—into distinct blocks of three.

[more]

The tabs below the encoded array show to which codewords each triplet is assigned, with the "key" to the encoding prepended to the encoded array. You can scroll through the five different examples of starting arrays by changing the value of the "encoding example" controls.

See Details for a more comprehensive explanation of the encoding.

[less]

Contributed by: Abigail Nussey (March 2011)
Based on a program by: Oyvind Tafjord
Open content licensed under CC BY-NC-SA


Snapshots


Details

Different starting datasets require a different number of codewords in order not to lose any information in the compression. The codewords are designated by numbers on the tabs. The "key" is prepended to the encoded array; the case of the initial example, for instance, shows that and . Dots are placed on the last member of each codeword. In the first example, each codeword is only one member long, but in other examples the codewords are longer.



Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.
Send