Thread: Huffman Code.
View Single Post
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,


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...
010 => becomes 'd'
1 => becomes 'a'
00 => becomes b

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!!!