Huffman Encoding
Assign each edge
the balance factor
.
Character | Code |
---|---|
NL | 10000 |
SP | 1111 |
a | 000 |
b | 10001 |
d | 0100 |
e | 101 |
g | 10010 |
h | 10011 |
i | 0101 |
n | 0110 |
r | 110 |
s | 0111 |
t | 001 |
v | 11100 |
y | 11101 |
Mathematical Properties of Binary Trees
A tree with N
internal nodes
has N + 1
external nodes
.