Discussion Board
Go to the previous messageGo to the following message
Current Forum: Homework 4 General Forum
Date: Fri Oct 5 2001 10:44 am
Author: Cipriani, Jason A. <jac4@andrew.cmu.edu>
Subject: Re: modifying FileBitReader/FileBitWriter

besides, an approximation method would require some way to scale down the numbers to 10 bits. Subtraction would not be acceptable as this would change the relationships between the sums of the minimum numbers, thus changing the tree:

Some numbers: 10 + 12 > 20
Subtract 8: (10 - 8) + (12 - 8) > (20 - 8)
Now look: 2 + 3 > 12

Well we know 5 is not greater than 12. So you have to use division. But then you run into the same risk.

Take, for example, a strange file with the following characters and frequencies:

'a' -> 2^14
'b' -> 2^13
'c' -> 1
'd' -> 2
'e' -> 2^14
'f' -> 5

I don't feel like drawing trees. But approximating those numbers in 10 bits each definitely alters the tree. Well, should you approximate the smaller numbers, or the greater numbers? 'a', 'b', and 'e' require 14 or 15 bits to store. You could keep the least significant 10 bits of the numbers, and just set the ones larger than 2^10-1 to 2^10-1... so:

'a' -> 2^10-1
'b' -> 2^10-1
'c' -> 1
'd' -> 2
'e' -> 2^10-1
'f' -> 5

That definitely changes the tree. You could shift everything to the right 5 bits. Then set the things that turn to 0 equal to 1. But then:

'a' -> 2^9
'b' -> 2^8
'c' -> 1
'd' -> 1
'e' -> 2^9
'f' -> 1

Also changing the tree. Therefore approximations do not work.
Post response

Go to the previous messageGo to the following message
Current Thread Detail:
modifying FileBitReader/FileBitWriter      Cipriani, Jason A.      Thu Oct 4 2001 12:09 am       
Re: modifying FileBitReader/FileBit...      Detwiler, Jay T.      Thu Oct 4 2001 9:32 am       
Re: modifying FileBitReader/File...      Cipriani, Jason A.      Thu Oct 4 2001 10:24 am       
Re: modifying FileBitReader/F...      Lee, Peter      Thu Oct 4 2001 1:48 pm       
Re: modifying FileBitReade...      Cipriani, Jason A.      Thu Oct 4 2001 3:51 pm       
Re: modifying FileBitRe...      Liu, Limin Angela      Thu Oct 4 2001 4:13 pm       
Re: modifying FileBi...      Cipriani, Jason A.      Thu Oct 4 2001 6:28 pm       
Re: modifying Fil...      Bortz, Andrew S.      Thu Oct 4 2001 8:06 pm       
Re: modifying ...      Cipriani, Jason A.      Thu Oct 4 2001 9:31 pm       
Re: modifyi...      Bortz, Andrew S.      Thu Oct 4 2001 10:06 pm       
Re: modify...      Cipriani, Jason A.      Fri Oct 5 2001 10:12 am       
Re: modify...      Cipriani, Jason A.      Fri Oct 5 2001 10:44 am       
Re: modify...      Cipriani, Jason A.      Fri Oct 5 2001 10:45 am       
Re: modifying FileBitReader/FileBit...      Maxim, Michael G.      Fri Oct 5 2001 6:12 pm       
Re: modifying FileBitReader/File...      Cipriani, Jason A.      Sat Oct 6 2001 10:28 am       
Re: modifying FileBitReader/F...      Bortz, Andrew S.      Sat Oct 6 2001 3:49 pm       

Back to previous screen