Current Forum: Homework 4 - Huffman Trees (Part 1) |
Date: Mon Oct 8 2001 11:13 pm |
Author: Lee, Charles C. <chucklee@cmu.edu> |
Subject: Re: general clarification on FileBitReader/Writer classes |
|
|
You can use BitReader to get the ascii value of each character and what you can do is make an array of length 256 (number of ascii characters). So when you encounter a byte value of 65, you up the frequency in the array index 65 by 1 and build your freq array that way, or you can use a vector.
For writing it to the compressed file, use bit strings to represent the code and you can use int to store the bitstring. and you can use writeBits(int,int) to write the bitstrings out. |
|