Compressed Text Encoding and Decoding Demo - using Huffman Tree

This applet simply demonstrates how a text can be compressed by using the Huffman encoding algorithm along with Huffman Tree and Heap. The tables below are just an example of comparison of encoding schemes.

Using a standard encoding scheme
 
Character Code Frequency Total Bits
a 000 10 30
e 001 15 45
i 010 12 36
s 011 3 9
t 100 4 12
space 101 13 39
new line 110 1 3
Total Bits required 174
Using the Huffman encoding scheme
 
Character Code Frequency Total Bits
a 001 10 30
e 01 15 30
i 10 12 24
s 00000 3 15
t 0001 4 16
space 11 13 26
new line 00001 1 5
Total Bits required 146

Notes on source codes: The source codes is not efficiently written in terms of complexity of running time.  view source code (to download, just right-click on the link and save it as .java file)

Command Syntax :

RESETDELAY number,  BEGIN-TEXT text,  END-TEXT,  FREQUENCY-TABLE, 
CREATE-CODE,  ENCODE,  DECODE,  STATS

NOTE : All commands should be capitalized, and each command and parameter should be separated by a single space.

Execute the following commands to test Huffman text encoding and decoding.
(COPY and PASTE the whole series of commands into the Text Area. Then, click on the Execute button)


by Hyung-Joon Kim, CSE373, University of Washington