»
Encode shorter sequences using a unique series of bits. When using
variable length bit sequences, you have to ensure that you can’t misinterpret
a shorter sequence in place of a longer one because they are similar. For
instance, if the letter a in binary is 110 and z is 110110, you could misinterpret
the letter z as a series of two-letter a characters. Huffman encoding avoids
this problem by using prefix-free codes: The algorithm never reuses shorter
sequences as initial parts of longer sequences. For example, if a is 110, then z
will be 101110 and not 110110.
Do'stlaringiz bilan baham: |