
Alternative Construction
In the coding scheme described previously the new interior nodes have always been attached at the end of the table provided that they have the same frequency. This rule could be changed in order to prefer the treatment of leaf nodes. Having the same frequency interior nodes could be placed above the leaf nodes, so that the following table would result:
a(5) a(5) a(5) -- 3(6) -+--> 4(11)
b(2) --> 1(2) --> 2(4) -+ a(5) -+
r(2) | b(2) -+ 1(2) -+
c(1) -+ r(2) -+
d(1) -+
Code Tree:

Symbol Frequency Code Word
a 5 0
b 2 111
r 2 110
k 1 101
d 1 100
< ^ >
|