Huffman coding: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: use format instead of right to diagnose size poblems)
Line 5,008: Line 5,008:
* 27.12.2013 Walter Pachl
* 27.12.2013 Walter Pachl
* 29.12.2013 -"- changed for test of s=xrange('00'x,'ff'x)
* 29.12.2013 -"- changed for test of s=xrange('00'x,'ff'x)
* 14.03.2018 -"- use format instead of right to diagnose size poblems
* Stem m contains eventually the following node data
* Stem m contains eventually the following node data
* m.i.0id Node id
* m.i.0id Node id
Line 5,137: Line 5,138:
End
End
End
End
Say 'Input ' s
Say 'Input ="'s'"'
Say 'result' sr
Say 'result="'sr'"'


Exit
Exit
Line 5,148: Line 5,149:
Say ' i pp id c f l r d'
Say ' i pp id c f l r d'
Do i=1 To m.0
Do i=1 To m.0
Say right(i,2) right(m.i.0o,3) right(m.i.0id,2),
Say format(i,3) format(m.i.0o,4) format(m.i.0id,3),
right(m.i.0f,2) right(m.i.0l,2) right(m.i.0r,2) m.i.0d m.i.0t
format(m.i.0f,3) format(m.i.0l,3) format(m.i.0r,3) m.i.0d m.i.0t
End
End
Call dbg copies('-',21)
Call dbg copies('-',21)
Line 5,328: Line 5,329:
1011110111000000001110111000011011101101011101001111101000110011010001
1011110111000000001110111000011011101101011101001111101000110011010001
00111110000110010
00111110000110010
Input this is an example for huffman encoding
Input ="this is an example for huffman encoding"
result this is an example for huffman encoding</pre>
result="this is an example for huffman encoding"</pre>


=={{header|Ruby}}==
=={{header|Ruby}}==