computing the length of codewords in Shannon-Fano-Elias

252 Views Asked by At

I have this message:

I should write a letter.

I want to code this message using Shannon-Fano-Elias method. First I should find the probability of each letter and then find its codeword. I'm confused about computing the Li (which shows the length of each codeword). which one of these Formulas should be used in order to find the Li:

Li = ceiling function of log(1/Pi)

or

Li = (ceiling function of log(1/Pi)) + 1