I have these 4 symbols with their probabilities:
x P(x)
--------
1 0.3
2 0.3
3 0.2
4 0.2
I built the Huffman tree in this way:
and I obtainded:
x P(x) C(x)
----------------
1 0.3 0
2 0.3 10
3 0.2 110
4 0.2 111
it's correct? Because according to the solution the results should be:
x P(x) C(x)
----------------
1 0.3 00
2 0.3 01
3 0.2 10
4 0.2 11
Why? Yet I followed the steps shown here.