Decoding Algorithm

To decode a file:

1.
Read in and reconstruct the encoding tree (see below).
2.
Read in the character count.
3.
While there are characters left to decode:
(a)
Start at the root of the encoding tree.
(b)
While not at a leaf node, read a bit from the input and go to the left or right child as appropriate.
(c)
Output the character in the leaf node.


Charles Stewart
10/2/1998