I coded a Huffman Algorithm.
I read a file into a String and then built a Huffman Tree and codes with the encoded data.
I put this in a new String and wrote it to new file, but it increases the size of file instead of decreasing it!!
I know what's wrong:
When input string is like "abc" it is 3*8=24 bit
However, when it is coded to "000111" it is 6*8=68 bit
Does anyone have any ideas?
How should I write the "000111" string in the output file so that it only needs 6 bits?
I am using Java.
Please Help.