I'm trying to code Huffman coding.I've formed my huffman tree but dont understand how I'm gonna assign bits to it.How do I do bit operations and how do i maintain bits of length 3,5 etc?
Any help appreciated
You need to keep track of how many bits you have "output" so far. When you get eight or more, output a byte. [code=C++] unsigned char bits = 0; // the unwritten bits int count = 0; // the number of unwritten bits // write_bit() // Write a single bit … Read More