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]
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.
Wolfram Demonstrations Project
Published: March 7 2011