What encoding do we get from the following Huffman tree ?
Symbol | Encoding #1 |
A | 0000 |
B | 01 |
C | 101 |
D | 1 |
E | 0000 |
Symbol | Encoding #2 |
A | 1 |
B | 01 |
C | 001 |
D | 0001 |
E | 0000 |
Symbol | Encoding #3 |
A | 1 |
B | 1 |
C | 1 |
D | 1 |
E | 0 |
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
We can trace through the tree to find out what each symbol is encoded as.
To find A, we take the left branch at the first fork, yielding 1.
To find B, we take the right branch at the first fork, and then at the second fork, branch left, yielding 01.
To find C, we take the right branch at the first fork, the right branch at the second fork, and the left branch at the third fork, yielding 001.
To find D, we take the right branch at the first fork, the right branch at the second fork, the right branch at the third fork, and the left branch at the fourth fork, yielding 0001.
To find D, we take the right branch at the first fork, the right branch at the second fork, the right branch at the third fork, and the right branch at the fourth fork, yielding 0000.