scala huffman encoding