Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Iterative Postorder Traversal algorithm for Huffman Coding

807603Oct 19 2007 — edited Oct 19 2007
Hello,

I am working on an implementation of Huffman encoding. Unfortunately, the book I have is written in C so I am having a tough time working things out in Java. After a bit of struggling, I have everything working using recursive postorder traversal. Now the last step would be to use iterative postorder traversal instead. Does anyone have the algorithm on hand? I basically take my huffman tree and walk it until I hit a leaf, inserting a zero into my encoding hash map every time i go left and a one every time I go right.

I would really appreciate the help. Recursive traversal is really easy to understand, but iterative gives me a headache.

my code is at http://www.jeah.net/~blanny/huffman.tar

Thank You,

Matthew
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 16 2007
Added on Oct 19 2007
1 comment
670 views