Please read the following guidelines carefully before looking into the Huffman Animation:
Whenever user select to view tree, the java applet will first show the user the nodes that is already sorted as in the picture. The nodes are sorted in ascending order according to the value of the probabilities from Left to Right. Basically the Tree is built over a number of Iterations. The Animation starts from Iteration 0.
To get to the next iteration, the user needs to click on the NEXT button. The user will then be able to observe the two least probabilities been combined to form a new tree. The process does not stop with the merging process, but it then proceeds to sort the the new tree. Notice that the tree is now painted yellow as to ease viewing and knowing which one of the tree that has just been merged. There two sorting algorithms provided in during the animation.
If the user continues clicking the NEXT button it will get this left view. Here when we get the Final Binary Tree, we put the bits of 0 and 1 on to the Left and Right Leaf respectively which will be inturn used to calculate the encoded bits of each alphabet. Take note that at this time the PREVIOUS button has now become active. The use can either select to go back to the previous tree by selecting PREVIOUS button or proceed by pressing on the NEXT button.
If the user proceeds to keep on clicking the NEXT button, the user will then be able to get to the final phase of the tree. At this moment the user will the see ENCODE and DECODE buttons become active. These two buttons are toggle buttons. For example, pressing the ENCODE button will make decode button becomes active and appears on the same button.
About Buttons :
Next : This button is pressed to get the next Iteration of the tree. Here in this case this button becomes Disbled when we get a final Binary Tree.
PREVIOUS : If at any stage after the first stage, the user wants to see or go to the previous Iteration then, this button is pressed.
FIRST : At any stage whewever a user wants to go to the First Iteration then, this button is pressed.
FINAL : This button is used and will only become active once user goes through all the iterations required to get to the final tree. Once this stage has been reached, user can always comes back to this phase by clicking on the final button.
ENCODE : The ENCODE and DECODE are two Commands which are placed on the same button. Clicking on the Encode will cause the necessary calculations to be done and makes decode command to be active. This button is only active at the final iteration or when final button has been pressed.By pressing this button it displays the decoded messages.
DECODE : Decode command will show the algorithm in trasversing the tree in decoding the code.
ENTROPY : Pressing on entropy will make length become active and vice versa. This button is only active at the final iteration or when final button has been pressed. It allows user to view the calculated Entropy.
LENGTH : Clicking on length will cause the entropy button becomes active and vice versa.This button is only active at the final iteration or when final button has been pressed. By pressing this button it display the calculated Average Code Length and the Compression Ratio.