Implement huffman coding and decoding