notes37

notes37 - -Monday-Data CompressionEncoding of...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ---Monday---Data CompressionEncoding of strings/textFixed Length Encoding-Each character is represented with the same number of bits: ExampleASCII: 1 byte/charUNICODE: 2 bytes/charVariable Length Encoding-Uses binary codes of different lengths to represent each characterPrefix rule in variable length encoding-To prevent ambiguities in each variable length encoding, each encoding should not be the prefix of another encoding011 – A010 – B10 – C010 10 011B C AThis encoding follows prefix rule and it is unambiguousWe use an “encoding trie” to represent the encoding to enforce the prefix ruleABRACADABRAIn ASCII it is going to be 8 bits/char 8*8 = 64 bits using ASCII.Using this variable length encoding 29 bits in total-Different encoding tries give different degrees of compression-We want the characters that appear more often to have the shortest encoding so the compressed string will be shorter.Huffman Encoding Trie-This is an algorithm that finds the optimal encoding for a given string-It builds the trie bottom up using characters/subtrees of smaller frequency first.ABRACADABRAHistogramChar - ABRCD# - 52211Step 152211ABRCDStep 22/ \52211ABRCDStep 342/ \ / \52211ABRCDStep 46/\42/ \/ \52211ABRCDStep 511/ \56A / \4 2/ \ / \2 2 1 1B R C DA = 0B = 100R = 101C = 110D = 111ABRACADABRATotal # of bits = 23, before it was 29 bits...
View Full Document

{[ snackBarMessage ]}

Page1 / 5

notes37 - -Monday-Data CompressionEncoding of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online