Thread: Huffman Code.
View Single Post
AUMathTutor
#3
Jun4-09, 07:25 PM
P: 490
The way it works is by having unique prefixes. What does that mean?

Let's say you have the following:
a :: 1
b :: 00
c :: 011
d :: 010

Now I give you a string of bits,

010100001111010101000101110100100101001010101001

How is this uniquely decodable? Well, we start reading from the left, and keep going to the right. We stop when the accumulated bits in the current string matches one of the entries in the table.

So here we go...
0
01
010 => becomes 'd'
1 => becomes 'a'
0
00 => becomes b
etc.

Basically, it's uniquely decodable because of the way the algorithm works, left to right, with prefix strings.

If you're asking whether or not things are uniquely encodable using Huffman's algorithm... they're not!!!