Hi all! I just picked up a java for beginners class - I'm about 3 weeks late, however, so I'm a bit behind. I'm reading as much as I can, and have figured out quite a bit of the visual side, fiddling with applets and stuff. For some reason it's the stuff that's supposed to be simple that I'm just not figuring out. I need to decompress a Huffman code (1100111001000100011110110 for example). Binary tree algorithms and other such complex (to me!) code wouldn't help me, since I wouldn't know what I was looking at - I was thinking more along the lines of a simple (albeit unrealistic, it's allowed!) switch statement to decompress the code. Anyone able to help me out? Thanks! Scott
Joined: Jun 02, 2003
Here's an array I put together, would this work? (I only included the first 5 letters of the code to save space). My only issue is I haven't included a null option, because 0 is a part of the code. I know.. total newbie issues.
What's your algorithm to decompress the code? Do you have any pseudo code? The posted code doesn't look like it will compile because of undeclared variable m. Should that be c ? Also, what is the result of code="b". It looks to me like you're trying to assign string "b" to the one hundred tenth element of a 13 element array.