Originally posted by Acoyani Garrido Sandoval:
But guess what? A computer can only handle full bytes. That's a big problem for me, 'cause I have absolutely no idea on how to handle these "partial bytes", and I don't think padding with zeroes would do, because that would make my program much, much less efficient.
As others have said, why worry about efficiency.
Sounds like a good assignment. One thing it will teach you is that its only modern computers driven from a particular set of engineering assumptions that even have a concept of a 'byte' which seems to be universally defined as 8 bits.
Some of the greatest old computers were
word oriented, and could pick up and write any number of bits anywhere in the word (which was often 36 bits). So it is good to break out of the mindset that a byte is an important concept, and that all bytes contain 8 bits.
Most compression systems use heavy packing, not only Huffman, but LZW, and similar approaches.
You can always use shift and XOR/AND/OR operators to do anything.