Hexadecimal representation while Huffman encoding

Giganews Newsgroups
Subject: Hexadecimal representation while Huffman encoding
Posted by:  Alex Vinokur (alex…@big-foot.com)
Date: Wed, 21 Jul 2004

Let T be the following Huffman code:

Symbol  Weight  Codeword
------  ------  --------
  a      1    00
  b      1    01
  c      1    10
  d      1    11

Encoded message 'abc' in binary representation is 000110.

How can one write 'abc' in hexadecimal representation?
To do that we have to append two bits to 000110.
But that action spoils the original message
  because the appended bits correspond to 'a' or 'b' or 'c' or 'd'.

Note. If some Huffman code contains at least one codeword of length > 4,
  the problem can be solved by appending bits
  which are a codeword of a _non-terminal_ node (not leaf).

  Alex Vinokur