How to write huffman tree into file

hey guys,
I am trying to write huffman tree into file but, I do not know the best way of doing it.Can anyone help me?

My huffman tree has a char for the letter and a number for the number of repeats.
Any help would be great :D

Thanks
the character is redundant. so for example if you just had
vector<int> chars(256);

then for the letter 'a' you can say that chars['a'] = count_of_a;

if this is a so-called text file you don't need all 256, you may only need a shifted table to handle the letters you need. If it is any file, you need them all.

depending on the expected file size, the int in that vector could be unsigned{char, short, int, 64 bit int, big-int-class}. 32 bit ints are sufficient for MOST files today.
Last edited on
Registered users can post here. Sign in or register to post.