hufffman compression
DiggBlinkRedditDeliciousTechnorati
question by ashwingz | Hard
? 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 :
D - 2
E - 5
W - 2
S - 1
? 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 Programming Question?
Just Sign Up and ask the top Programming experts!
|