# Total weight of Huffman Code

We are given the following letters with the respective frequencies:

$$\begin{equation*}\begin{matrix}a/2 & b/4 & c/7 & d/6 & e/4 & f/5 & g/8 & h/10 & i/3 & j/11\end{matrix}\end{equation*}$$

For that I have applied the Huffman code and I got the following tree:

Now it is asked for the total weight of the code. How do we calculate that?

Do we maybe use the formula $$\displaystyle\sum_{c\in C}f(c)d(c)$$ ?

Then we have $$2\cdot 4+3\cdot 4+5\cdot 3+6\cdot 3+7\cdot 3+4\cdot 4+4\cdot 4+8\cdot 3+10\cdot 3+11\cdot 3=193$$ Is that correct?

• I have never heard of the "total weight" of a prefix code. Ask your professor. – Yuval Filmus Jun 5 '20 at 19:30
• Usually we are interested in the average length of a codeword, and sometimes also in the maximum length of a codeword. – Yuval Filmus Jun 5 '20 at 19:31
• Ahh ok! I will ask. The formula I wrote above what does it represent? @YuvalFilmus – Mary Star Jun 5 '20 at 19:47
• Formulas are not so important. The two parameters I mentioned are interesting on their own. The formula defining them is less important than their meaning. – Yuval Filmus Jun 5 '20 at 19:49