Program 3 Demo Applet

No Java 2 SDK, Standard Edition v 1.4 support for APPLET!!

This applet demonstrates the CREATE-LEAF and MERGEALL commands to the forest of Huffman trees. It first inserts a bunch of 1-node Huffman trees into the forest and then it merges them all, repeatedly taking the two minimum-weight trees, combining them, and inserting the combined tree back into the forest.

In the priority queue, each tree is shown using its weight and its leftmost leaf's symbol. In this demo, the final tree happens to have the letter 's' as its leftmost symbol. This is arbitrary and it could either be left blank, or a label such as "T1" could be put in there. The index of the tree in the array is used as the name of the tree in the display of Huffman trees. Thus the tree in array position 1 is called T1, etc.

S. Tanimoto, Dept. of Computer Science and Engineering, University of Washington. (C) 2004.