Hello, I am stuck trying to solve the following question:

Use the ternary Huffman coding on the following:

x1 = 0.49

x2 = 0.26

x3 = 0.12

x4 = 0.04

x5 = 0.04

x6 = 0.03

x7 = 0.02

I understand and I am perfectly capable of applying the binary Huffman coding, however, I keep getting stuck on ternary. I know that instead of two lowest probability characters I need to join three etc. But when working out the codewords, some of them do not match, which is probably the way I keep drawing the trees. For example, my coding for x4 is 21 and x5 = 210, however they are wrong. How do you actually draw the trees?

The following link contains the correct solutions but does not say how to work it out. It's question 5.4c

[HTML]http://www.ifp.illinois.edu/~srikant/ECE563/hw3_sol.pdf[/HTML]