Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15...

15
2/27/2013 1 Lecture 2 Huffman Coding

Transcript of Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15...

Page 1: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

1

Lecture 2

Huffman Coding

Page 2: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

2

Page 3: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

3

Page 4: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

4

Page 5: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

5

Page 6: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

6

Page 7: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

7

Page 8: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

8

Page 9: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

9

Page 10: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

10

Page 11: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

11

Page 12: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

12

Page 13: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

13

Page 14: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

14

Multiple code

Letter Probability Code

a1a1 0.64

a1a2 0.016

a1a3 0.144

a2a1 0.016

a2a2 0.0004

a2a3 0.0036

a3a1 0.1440

a3a2 0.0036

a3a3 0.0324

-------------

∑ P (aiaj) = 1

Page 15: Lecture 2: Huffman Codingdttin/Data compression/Lecture 02... · 2013-02-27 · 2/27/2013 15 Exercises 1. Using the Huffman tree constructed in this session, decode the following

2/27/2013

15

Exercises

1. Using the Huffman tree constructed in this session, decode the

following sequence of bits, if possible. Otherwise, where does the

decoding fail?

10100010111010001000010011

2. Using the Huffman tree constructed in this session, write the bit

sequences that encode the messages:

test , state , telnet , notes

3. Mention one disadvantage of a lossless compression scheme and one

disadvantage of a lossy compression scheme.

4. Write a C/C++/Matlab program that implements the Huffman coding

algorithm.