Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have been trying to follow this video to implement my own Arithmetic Coding algorithm in Java. I am having a bit of trouble figuring out what some of the variables in the video should be.

For example if I have:

An Input alphabet - { 1,  2  , 3 , 4}
Probabilities     - {0.1,0.1,0.1,0.7} 
An Input of       - [12312]

Would my values for the following be correct?

P1 = 1/4
P2 = 1/4
P3 = 1/4
P4 = 1/4

C1 = 0
C2 = 1
C3 = 2
C4 = 3

D1 = 1
D2 = 2
D3 = 3
D4 = 4 

I am pretty confused by some definitions in the linked video, any advice would be appreciated !

share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.