I have a project that should compress and decompress the text files in Java. I understand the Huffman algorithm, but I don't know how to code the whole project. Who can help me?
A:
If that is homework and you are willing to forfeit your education and future by blindly copying what some random guy on the net told you, then you may want to have a look at jgz, an implementation in Java of the Deflate compression algorithm. Part of it uses Huffman codes. I wrote that code as a way to understand how Deflate works; since I left comments, that implementation may also help other people as well. Happy code reading.
Thomas Pornin
2010-02-17 16:50:26