Here you can ask questions and find or give answers to organizational, academic and other questions about studying computer science.

1.1k questions

1.3k answers

1.7k comments

556 users

0 votes
Hi,

Is there more than one representation for the letters? For example, I got for L 0001, but in the solutions it's either 001 or 01110. I also got some other letters wrong, but some of them are true.
in # Mandatory Modules Bachelor by (380 points)

1 Answer

+2 votes
 
Best answer
There is more than one correct solution. In the example, we have probabilities (E,0.5);(O,0.125);(S,0.125);(U,0.10);(L,0.05);(N,0.05);(G,0.05) and Huffman encoding is based on a sorting of the letters according to their probabilities. As there are some letters with the same probabilities, you can sort differently and this way you get different codes. Their average number of bits per symbol should however be the same, even though for certain symbols you will have different number of bits. For example, for L,N,G two will have five bits and one of them just four, which one does not matter for the average number of bits per symbol, but of course for the particular encoding it matters.
by (170k points)
selected by
So there could be one representation for example where L,N,G are four bits? Or it strictly has to be two five bits + one four bit?

Related questions

+3 votes
1 answer
0 votes
1 answer
asked Aug 23, 2020 in # Mandatory Modules Bachelor by kremenadla (380 points)
+1 vote
1 answer
+1 vote
1 answer
asked Aug 23, 2020 in # Mandatory Modules Bachelor by least (260 points)
0 votes
1 answer
asked Aug 23, 2020 in # Mandatory Modules Bachelor by VF (120 points)
Imprint | Privacy Policy
...