I see this is for a huffman tree(of which there are different compressions); when I created a huffman encoder/decoder (in c++) I found it almost essential to create a bit stream class (although you could use structs for the same purpose). Just thought I would throw this idea out there, as it makes reading and writing huffman codes far easier
