Efficient way of storing Huffman tree

Since you already have to implement code to handle a bit-wise layer on top of your byte-organized stream/file, here’s my proposal. Do not store the actual frequencies, they’re not needed for decoding. You do, however, need the actual tree. So for each node, starting at root: If leaf-node: Output 1-bit + N-bit character/byte If not … Read more