Adaptive Huffman coding: Difference between revisions

Content deleted Content added
Everyking (talk | contribs)
Gnomz007 (talk | contribs)
Line 27:
For every symbol transmitted on both sides we must execute '''update procedure''':
 
1. If current symbol is NYT, add two child nodes to NYT node, one will be a new NYT node the other is leaf node for our symbol, increase weight for new leaf node and old NYT, '''goto step 4''' <br>
'''else'''<br>
go to symbols leaf node.
 
1. If current symbol is NYT, add two child nodes to NYT node, one will be a new NYT node the other is leaf node for our symbol, increase weight for new leaf node and old NYT, '''goto step 4''' <br />
3. If this node does not have the highest number in a block swap it with which has the highest number
'''else'''<br />
go to symbolssymbol's leaf node.
 
32. If this node does not have the highest number in a block swap it with which has the highest number
4. Increase weight for current node
 
43. Increase weight for current node
 
54. If this is not the root node go to parent node, '''goto step 32'''<br>else end<br/>
'''else end'''<br />
 
5. If this is not the root node go to parent node, '''goto step 3'''<br>else end<br>
 
Note: swapping nodes means swapping weights and corresponding symbols, but not the numbers.