I'm working on a Huffman tree and I'm trying to figure out how to traverse the tree to find the node that has the character that I'm looking for. While searching the tree i need to keep a string of the path that is taken to the node that I'm looking for using 1's and 0's (0 left 1 right). How can i do this?
Long time since i wrote a huffman engine, but i'll give it a shot.
Assuming your Huffman Tree Node looks like this
So here's recursive function (converting it to iterative should be easy)
call it this way