Talk:Canonical Huffman code
Appearance
This article probably needs the examples rewriting as Canonical Huffman coding starts with all-zeros for the shortest code and ends with all-ones for the longest code:
A 0 B 10 C 110 D 111
This is opposite to the examples as given. The method for construction is then:
code = 0 while more codes: print code code += 1 if next bit length: code <<= 1