Current Forum: Homework 4 - Huffman Trees (Part 1) |
Date: Sun Oct 7 2001 10:06 pm |
Author: Liu, Limin Angela <laliu@andrew.cmu.edu> |
Subject: Re: wingdings, etc |
|
|
That's exactly what you are looking for. Say you have a text file looking like this:
ababab
When you construct your tree, your tree will probably look like this:
7 / \ 4 'a' / \ 'nl' 'b' So your code would be converted to
10110110100
When you examine this file, 10110110 will be read the first time you read in a byte, and since the dec number is 182, the ASCII character at 182 will be shown on the screen. And so on...
So the saving for this file is from 7*8 bits into 11 bits (if we don't consider the bits occupied by the char frequencies). |
|