A
A_StClaire_
hi all,
I'm trying to implement Huffman coding on letters of a string. I've
written functions to define the initial leaf nodes (letters and their
frequencies) and to sort them. I've also put together the actual tree
with its appropriate nodes and child nodes.
however I'm having some trouble developing a means of traversing the
tree itself to create the binary key table. i.e., how would I know how
many levels the tree has? this will change with every different string
length. should I store the number of levels in a variable? should I
write a recursive function?
thx for your help
I'm trying to implement Huffman coding on letters of a string. I've
written functions to define the initial leaf nodes (letters and their
frequencies) and to sort them. I've also put together the actual tree
with its appropriate nodes and child nodes.
however I'm having some trouble developing a means of traversing the
tree itself to create the binary key table. i.e., how would I know how
many levels the tree has? this will change with every different string
length. should I store the number of levels in a variable? should I
write a recursive function?
thx for your help