Current Forum: Homework 4 General Forum |
Date: Thu Oct 4 2001 9:31 pm |
Author: Cipriani, Jason A. <jac4@andrew.cmu.edu> |
Subject: Re: modifying FileBitReader/FileBitWriter |
|
|
well, my implementation takes 1 bit for each "fork" in the tree, and 9 bits for each character.
so, the maximum amount is 1*255 + 9*256 = 2559 bits = 320 bytes in the worst case.
storing frequencies is 32 bits * 256 characters = 8192 bits = 1024 bytes in the worst case.
i would hardly say that storing frequencies is better in the worst case. as a matter of fact, storing frequencies can NEVER be better unless you are using less than 10 bits per character. that limits you to 1024 for the value of the frequency count.
so, recursively storing the tree is better in all cases. |
|