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!

Help with Huffman encoding

807591Apr 27 2008 — edited Apr 28 2008
I've run into a bit of a problem trying to encode a text file using Huffman encoding. I've read in all the characters, counted their frequencies, and built the encoding tree. The part I'm having problems with is getting the code for each character. I understand how you're supposed to get it, adding zero to the code if you go left and one if you go right until you hit a leaf, I just can't figure out how to implement it. I have the tree implemented using a Node structure with each Node having a point to its left and right child. Could anyone point me in the right direction?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 26 2008
Added on Apr 27 2008
3 comments
359 views