The Applet:
This is an applet written by Walter Korman for an excellent article on compression "Data Compression: Bits, Bytes and Beefalo" in Deep Magic. I modified it slightly so that it can accept a string from a form, but all the credit goes to him.
All you have to do is enter a string into the form and press "Run Applet". The applet demonstrates the encoding and decoding of the string, but not the building of the tree.
Try strings with only a few characters that are repeated different amounts.
For example: "aaabbccddddddeee" or "yabba dabba doo".