I have implementated [a simple compressor](http://code.google.com/p/jcyangs-alg-trunk/source/browse/trunk/bk/APIDSAA/ch5_binary_tree/Huffman/wHuffmanApp.cc) using pure huffman code under Windows.But I do not know much about how to decode the compressed file quickly,my bad algorithm is:

Enumerate all the huffman code in the code table then compare it with the bits in the compressed file.It turns out horrible result:decompressing 3MB file would need 6 hours.

Could you provide a much more efficient algorithm?Should I use Hash or something?

**Update**:
I have implementated [the decoder](http://code.google.com/p/jcyangs-alg-trunk/source/browse/trunk/bk/APIDSAA/ch5_binary_tree/Huffman/DecodeHuffmanTree.h) with state table,based on my friend Lin's advice.I think this method should be better than travesal huffman tree,3MB within 6s.

thanks.