Given a Huffman Tree with struct trees composed of (only) the following members:
Code:
typedef struct tree
{
char symbol;
int frequency;
struct tree* left;
struct tree* right;
}
Tree;
I'm wondering about the process of traversing such a tree to obtain the encoding values.
I assume that as each leaf of this tree is encoded, it would then be necessary to remove it from the tree so as not to repeat traversal of the same leaf.
Is my assumption correct, or is there another way (without including member-data such as the 'level' of the node) to go about such a process?
Thanks for any help.