0

I'm trying to write a program in c for Huffman coding, but i stack.In input i have:

Sample input:
4      //here i scan how many letters i have
A 00    // and for everyone i scan how they are coded in string down
B 10     
C 01
D 11
001010010101001011010101010110011000 //this is an unoptimal huffman code 

So first i have to decode this string, and to find out how many times every letter appear.And i already do that.But now i have to find out how many bits have every letter using huffman tree, and in the output i have to print the average bit per simbol. The output for this example here have to be:

Sample output
1.722

So now, how to find out how many bits have every letter with huffman coding ? Please help :(

Maria
  • 29
  • 1
  • 1
  • 2

0 Answers0