functions for huffman,trit, and nucleotide encoding