CLASS NOTES
DATA COMPRESSION:
Encoding of strings:
Each character is represented with the same number of
bits .ASCII(which has 8 bits per character) and UNICODE(which has 16 bits
per character) are examples of fixed length encoding.
Variable length encoding:
Uses binary codes of different length to represent each
character.
Data compression comes from this type of encoding.
Prefix Rule in Variable length encoding :

To prevent ambiguities in variable length encoding, each
encoding should not be the prefix of another encoding.
Ex 1: 011A, 010 B,10C
010 10 011== B C A
This encoding is unambiguous since it follows the prefix rule.
Ex 2: 011A, 010B, 01C
010 100 11
This encoding is ambiguous since C is the prefix of B and A.
We therefore use and encoding “trie” to represent the encoding and to enforce
the prefix rule.
/*Image*/
For the above tree,A=010,B=11,C=00,D=10 AND R=011.
So, using the above encoding 01011011010000101001011011010 consists of 11
characters and uses 29 bits, but had this been in Ascii it would’ve had 11
characters and 88 bits instead.
# Different encoding tries give different degrees of compression.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 Staff
 Graph Theory, Data Structures, Planar graph, vertices

Click to edit the document details