Suppose X is an i.i.d. r.v. with an infinite alphabet, X = {1, 2, ...}. I also have P(X = i) = 2^{−i}
I want to find the coding scheme for an optimum variable length code however I don't follow the solutions coding scheme.
It appears that they have a 0 preceded by a 1 each time as you go down. Can someone please explain this to me.
For reference I have attached images/links of my question and solution as I am unsure of the policy of this website with not typing questions.
You get a prefix free code due to the pattern you mention.
Apply Huffman's algorithm to any finite truncation (you'd need to scale the probabilities but huffman doesn't care). For example
would lead to B,C being merged giving the codewords, say,
This argument may be extended to any finite length code source distribution $$(2^{-i})_{i=1}^n,$$ and also used to prove the achievability of the infinite expected codeword length of 2.