# Huffman Coding vs Arithmetic Coding

Are there conditions under which given text $$T$$ that huffman code and arithmetic code will produce the exact encoding of $$T$$?

• Of course. I assume it’s homework, so I’ll just say it’s really easy to show. Jan 28, 2019 at 20:24
• This is for preparation for the exam.A friend told me that the exact opposite. Meaning that there are no conditions since Huffman is based on frequencies and the arithmetic takes the frequencies and uses them to find an interval. So if you say it's true what is the reason for that?
– Kate
Jan 28, 2019 at 21:03
• That's an argument why they are usually different. Figure out why arithmetic coding is usually more efficient. Then figure out in which situations is is not more efficient, but exactly as efficient as Huffman. And there you get your conditions. Jan 28, 2019 at 21:30

yes, if all probabilities are in form of $$2^{-k}$$ then the arithmetic encoding will be the same as huffman encoding. both achieving the expected length of $$H(X)$$ (entropy).