Huffman coding: Difference between revisions

Content added Content deleted
(Gave non-sorted example for test runs.)
m (changed freq. so freq order != letter order)
Line 27: Line 27:


Write a program which reads in symbols and frequencies in pairs separated by whitespace and generates Huffman codes for each symbol. Test your program with the following line of letter frequencies, as input:
Write a program which reads in symbols and frequencies in pairs separated by whitespace and generates Huffman codes for each symbol. Test your program with the following line of letter frequencies, as input:
<pre>"B 25 C 12.5 D 12.5 A 50 \n"</pre>
<pre>"B 25 C 2.5 D 12.5 A 5 \n"</pre>


=={{header|Java}}==
=={{header|Java}}==