User Tools

Site Tools


atrac3p:canonical_huffman_trees

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

atrac3p:canonical_huffman_trees [2009/11/16 22:35] – created megadiscmanatrac3p:canonical_huffman_trees [2009/11/16 22:35] (current) megadiscman
Line 4: Line 4:
  
 As an example: As an example:
-   A 3 bits +   A 3 bits 
-   B 2 bits +   B 2 bits 
-   C 3 bits +   C 3 bits 
-   D 1 bit+   D 1 bit
  
 Allocation of codes starts with the shortest code, so ''D'' gets ''0'', all later codes need to start with ''1''. Then codes of length 2 are allocated, this is only ''B'', so ''B'' gets the first 2-bit code starting with ''1'', namely ''10''. All later codes need to start with ''11''. Last are the two 3-bit codes for ''A'' and ''C''. As ''A'' lexicographically preceedes ''C'', ''A'' gets the code ''110'' and ''C'' gets ''111''. Allocation of codes starts with the shortest code, so ''D'' gets ''0'', all later codes need to start with ''1''. Then codes of length 2 are allocated, this is only ''B'', so ''B'' gets the first 2-bit code starting with ''1'', namely ''10''. All later codes need to start with ''11''. Last are the two 3-bit codes for ''A'' and ''C''. As ''A'' lexicographically preceedes ''C'', ''A'' gets the code ''110'' and ''C'' gets ''111''.
  
atrac3p/canonical_huffman_trees.1258410933.txt.gz · Last modified: 2009/11/16 22:35 by megadiscman

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki