next up previous
Next: The HuffTree Up: Assignment 11: Huffman Codes Previous: Assignment 11: Huffman Codes

The Frequency table

Create a class called FreqTab that builds a table that contains the frequency of letters in a text sample.

  1. You can use an array, Vector or Hashtable to implement the frequency table.
  2. You might want to pass the text sample as a parameter to the FreqTab constructor, and make the frequency table an instance variable.
  3. You should write a method that prints the contents of the table.
  4. Rather than allow client code direct access to the contents of the table, you should provide accessor methods. For example, you might write frequency, which takes a letter (character) and returns the number of times it appears in the sample text.



Allen Downey
Mon Nov 20 11:50:58 EST 2000