Implemented HuffmanTree and encoding.