Path: utzoo!attcan!ncrcan!brambo!camtwh!morgan
From: morgan@camtwh.UUCP (Morgan W. Jones)
Newsgroups: comp.sys.amiga.tech
Subject: Re: huffman encoding
Message-ID: <228@camtwh.UUCP>
Date: 3 Oct 89 16:05:09 GMT
References: <467@crash.cts.com>
Reply-To: morgan@camtwh.UUCP (Morgan Jones)
Organization: Orama Incorporated, Toronto, Canada.
Lines: 19

In article <467@crash.cts.com> uzun@pnet01.cts.com (Roger Uzun) writes:
>Of course i realize that the huffman tree for a file that has
>256 unique elements is not optimal for files that have less than that,
>but I am trying to simplify things a bit.
>So I should have asked for the huffman bit patterns and bit counts
>for the constant encoding tree that would be used on files that
>have 256 unique elements.

You realize of course that a huffman tree generated for a binary file
would be rather useless for a text file (or at least you'd get very
little compression).  If you wanted to do a fixed compression in one
pass without determining the type of the file, you might want to
initialize the char count to all ones (rather than all zeros) and
count the number of occurances in the first two blocks (1024 bytes) of
the file, build your tree and compression table (which is very easy if
you know anything at all about trees), and then compress the file.
-- 
Morgan W. Jones					(morgan@camtwh)
Orama Incorporated, Toronto, Canada.		(416) 369-5088