[Zlib-devel] Huffman counting breakthrough

Mark Adler madler at alumni.caltech.edu
Mon Dec 25 02:34:50 EST 2006


zlibbers,

I'm not sure who out there will care, but I'm going to subject you  
all to this anyway.  It suddenly occurred to me today how to do  
something I've been trying to figure out, on and off, for about a  
decade.  I then implemented the idea and it worked.  I now know how  
many possible complete deflate literal/length Huffman codes exist.   
The answer is 18,418,653,064,601,104.

Ok, you're thinking: "Um, yeah, so?".  Aside from the sheer  
mathematical satisfaction of having counted that high, this is the  
first step in finally determining the proper value for the constant  
ENOUGH in zlib's inflate (specifically in inftrees.h).  I now know  
how to generate and search all of those codes efficiently.  If anyone  
is curious about how the codes were counted, you can look at  
codecount.c:

     http://zlib.net/codecount.c

Happy holidays!

mark





More information about the Zlib-devel mailing list