next up previous
Next: About this document ... Up: Assignment 11: Huffman Codes Previous: Build the Huffman tree

Build the Code Table

1.
Create a new class named CodeTab that contains an array of codes. The codes will be represented as Strings containing 1's and 0's.

2.
Add the methods buildCodeTab and encode to the Huffman class. encode should take a String and return a String of 1's and 0's that represents the String according to the appropriate Huffman code.



Allen Downey
1999-11-20