Docsity

Lossless Data Compression - Data Base Management System - Lecture Slides, Slides of Database Management Systems (DBMS)

Partial preview of the text

Download Lossless Data Compression - Data Base Management System - Lecture Slides and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Lossless Decomposition and

Huffman Codes

Lossless Data Compression

• Any compression algorithm can be viewed as a

function that maps sequences of units into other

sequences of units.

• The original data to be reconstructed from the

compressed data. - Lossless

• Lossless is in contrast to lossy data compression,

which only allows an approximation of the

original data to be reconstructed in exchange for

better compression rates.

Decoding

Symbol Code

E 0

T 11

N 100

I 1010

S 1011

To determine the original message, read the string of bits from left to right
and use the table to determine the individual symbols
Decode the following: 11010010010101011

Decoding 11

Symbol Code

E 0

T 11

N 100

I 1010

S 1011

0 100 100 1010 1011 T (^) E N N I S

Original String:

Constructing Huffman Codes

• Goal: construct a prefix code for Σ:

associate each letter i with a codeword w

i

to minimize the average codeword length:

Example

Letter pi wi A 0.1 000 B 0.1 001 C 0.2 01 D 0.3 10 E 0.3 11

Where pi = probability of w i

Example

Symbol Probability

A 0.

B 0.

C 0.

D 0.

E 0.

Example – Creating the tree

Symbol Probability A 0. B 0. C 0. D 0. E 0. D 0.

C

0.

A

0.

B

0.

E

0.

Example – Iterate Step 2

Note: when two nodes are
connected by a parent, the
parent should be evaluated in
the next iteration
D

0.

C

0.

A

0.

B

**0. E

0.**

D

0.

B

0.

A

0. C 0.

E

0. 0.258 0. 0.

Example – Iterate Step 2

Example: Table for Huffman Code Symbol Probability A 0 B 111 C 110 D 100 E 101

Generate the table by reading from the root node to the

leaves for each symbol

Practice

Symbol Occurrences Huffman Code A 0.45? B 0.13? C 0.12? D 0.16? E 0.09? F 0.05?

Questions?