Struggling with Digital Communications work - i don't really want the answer given to me, just the method of working it out.

A six symbol source alphabet, S, has symbol probabilities

{0.3, 0.2, 0.19, 0.1, 0.14, 0.07}.

Calculate H(S). Is there a compact code for S with average codeword length 2.4??



I have worked out H(S) and found it to be 2.439. I just don't know about the compact code part.
Appreciate any help.

Shaun Gill