Sunday, December 21, 2008

Huffman coding

I've been playing with Scheme a bit. After hearing about Huffman compression in a lecture, I first wrote something in Python, but noticed that the recursion I used lent itself well to a functional language, especially where tail-calls were optimized. So I wrote this:

I've used it to construct a table for 9000 symbols with no problems, so it works pretty well. Can be downloaded here.