Adaptive Huffman coding: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 96:
Step 4:
 
Go to leaf node 253. Notice we have two blocks with weight 1. Node 253 and 254 is one block (consisting of leaves), node 255 is another block (consisting of internal nodes). For node 253, the biggest number in its block is 254, so swap the weights and symbols of nodes 253 and 254. Now node 254 and the branch starting from node 255 satisfy the SlideAndIncrement condition<ref name=":0"/> and hence must be swopswapped. At last increase node 255 and 256’s weight.
 
Future code for "b" is 1, and for "a" is now 01, which reflects their frequency.