huffman compression in java
DiggBlinkRedditDeliciousTechnorati
question by ashwingz | Moderate
Frequency Table:
D - 2
E - 5
W - 2
S - 1
You will have to write a program to do the following:
? Read in the text to be compressed from the keyboard. Assume it does not contain white space characters and any non-alphabetic characters.
? Calculate the frequency of each character and print out the frequency table as shown in the Introduction.
? Then create the tree using the method explained below.
? Print the encoding table for each character as shown in Introduction. Use non-recursive post-order tree traversal.
? Compression: the encoding table and print out the compressed form of the input text.
? Decompression: Use the compressed form of the text you got in the previous step and expand it using the Huffmann tree created in step 3 (don?t use the encoding table for decompression). You should get the original input text as the output.
Post reply
Subscriptions
Got a Java Question?
Just Sign Up and ask the top Java experts!
|