File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Simple Huffman Code decomposition Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Simple Huffman Code decomposition" Watch "Simple Huffman Code decomposition" New topic

Simple Huffman Code decomposition

Scott Grant

Joined: Jun 02, 2003
Posts: 5
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?
Scott Grant

Joined: Jun 02, 2003
Posts: 5
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.
Stevie Aldrich

Joined: Feb 27, 2003
Posts: 2
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[110]="b". It looks to me like you're trying to assign string "b" to the one hundred tenth element of a 13 element array.
I agree. Here's the link:
subject: Simple Huffman Code decomposition
It's not a secret anymore!