Discussion Board
Go to the previous messageGo to the following message
Current Forum: Homework 4 - Huffman Trees (Part 1)
Date: Wed Oct 10 2001 12:46 am
Author: Lee, Charles C. <chucklee@cmu.edu>
Subject: Re: remaining bits

There's another possible way of solving this problem. From readHeader() we get the freqs vector. And from this, we add up all the frequencies of each character so we know the number of ascii characters in the file. Call that number blah, then blah will also be the number of times you will traverse the Huffman tree to find the character that corresponds with each bitstring. Make a counter=0, then everytime you are at the leaf, increment counter by 1 and stop when counter = blah. If you built the Huffman tree correctly, the remaining bits won't be read. Thus, you end up not modifying the readHeader() or making an psuedo-EOF.
Post response

Go to the previous messageGo to the following message
Current Thread Detail:
remaining bits      Douglas, Keith      Sun Oct 7 2001 8:48 pm       
Re: remaining bits      Liu, Limin Angela      Sun Oct 7 2001 9:55 pm       
Re: remaining bits      Bortz, Andrew S.      Sun Oct 7 2001 10:12 pm       
Re: remaining bits      Lee, Charles C.      Sun Oct 7 2001 11:44 pm       
Re: remaining bits      Cipriani, Jason A.      Mon Oct 8 2001 3:44 pm       
Re: remaining bits      Jen, Cindy Dar-Shuan      Tue Oct 9 2001 2:30 am       
Re: remaining bits      Bortz, Andrew S.      Tue Oct 9 2001 12:26 pm       
Re: remaining bits      Cipriani, Jason A.      Wed Oct 10 2001 12:51 am       
Re: remaining bits      Abeles, Peter J.      Wed Oct 10 2001 12:26 am       
Re: remaining bits      Ghosh, Debmallo S.      Thu Oct 11 2001 1:45 pm       
Re: remaining bits      Cipriani, Jason A.      Mon Oct 8 2001 3:46 pm       
Re: remaining bits      Lee, Charles C.      Wed Oct 10 2001 12:46 am       
Re: remaining bits      Cipriani, Jason A.      Wed Oct 10 2001 12:56 am       
Re: remaining bits      Lee, Charles C.      Wed Oct 10 2001 5:04 pm       

Back to previous screen