Top Banner
Huffman Codes Analysis of Algorithms Prof. Muhammad Saeed 1
14

Huffman Codes

Dec 31, 2015

Download

Documents

doris-mcintosh

Analysis of Algorithms. Huffman Codes. Prof. Muhammad Saeed. Standard Coding Scheme. Table Code length=3. Tree. Standard Coding Scheme. Table Code length=3. Tree. Standard Coding Scheme. Table Variable Code Length. Prefix Code. Tree. Standard Coding Scheme. Table. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Huffman Codes

Huffman Codes

Analysis of Algorithms

Prof. Muhammad Saeed

1

Page 2: Huffman Codes

Character Code Frequency Total Bits

a 000 10 30

e 001 15 45

i 010 12 36

s 011 3 9

t 100 4 12

space 101 13 39

newline 110 1 3

Total 58 174

Standard Coding SchemeTableCode length=3

Tree

Analysis of Algorithms

2

Page 3: Huffman Codes

Character Code Frequency Total Bits

a 000 10 30

e 001 15 45

i 010 12 36

s 011 3 9

t 100 4 12

space 101 13 39

newline 110 1 2

Total 58 173

Standard Coding Scheme

Tree

TableCode length=3

Analysis of Algorithms

3

Page 4: Huffman Codes

Character Code Frequency Total Bits

a 001 10 30

e 01 15 30

i 10 12 24

s 00000 3 15

t 0001 4 16

space 11 13 26

newline 00001 1 5

Total 58 146

Standard Coding SchemeTableVariableCode Length

Tree

Analysis of Algorithms

4

Prefix Code

Page 5: Huffman Codes

Character Code Frequency Total Bits

a 001 10 30

e 01 15 30

i 10 12 24

s 00000 3 15

t 0001 4 16

space 11 13 26

newline 00001 1 5

Total 58 146

Standard Coding SchemeTable

Formation of Treeand

Code generation

Analysis of Algorithms

5

Page 6: Huffman Codes

Character Code Frequency Total Bits

a 001 10 30

e 01 15 30

i 10 12 24

s 00000 3 15

t 0001 4 16

space 11 13 26

newline 00001 1 5

Total 58 146

Standard Coding SchemeTable

Formation of Treeand

Code generation

Analysis of Algorithms

6

Page 7: Huffman Codes

Character Code Frequency Total Bits

a 001 10 30

e 01 15 30

i 10 12 24

s 00000 3 15

t 0001 4 16

space 11 13 26

newline 00001 1 5

Total 58 146

Standard Coding SchemeTable

Formation of Treeand

Code generation

Analysis of Algorithms

7

Page 8: Huffman Codes

Character Code Frequency Total Bits

a 001 10 30

e 01 15 30

i 10 12 24

s 00000 3 15

t 0001 4 16

space 11 13 26

newline 00001 1 5

Total 58 146

Standard Coding SchemeTable

Formation of Treeand

Code generation

Analysis of Algorithms

8

Page 9: Huffman Codes

Character Code Frequency Total Bits

a 001 10 30

e 01 15 30

i 10 12 24

s 00000 3 15

t 0001 4 16

space 11 13 26

newline 00001 1 5

Total 58 146

Standard Coding SchemeTable

Formation of Treeand

Code generation

Analysis of Algorithms

9

Page 10: Huffman Codes

Character Code Frequency Total Bits

a 001 10 30

e 01 15 30

i 10 12 24

s 00000 3 15

t 0001 4 16

space 11 13 26

newline 00001 1 5

Total 58 146

Standard Coding SchemeTable

Formation of Treeand

Code generation

Analysis of Algorithms

10

Page 11: Huffman Codes

Character Code Frequency Total Bits

a 001 10 30

e 01 15 30

i 10 12 24

s 00000 3 15

t 0001 4 16

space 11 13 26

newline 00001 1 5

Total 58 146

Standard Coding SchemeTable

Analysis of Algorithms

11

Formation of Treeand

Code generation

Page 12: Huffman Codes

Analysis of Algorithms

12

Page 13: Huffman Codes

Analysis of Algorithms

13

Symbol Probability Codeword

K 0.05 10101

L 0.2 01

U 0.1 100

W 0.05 10100

E 0.3 11

R 0.2 00

? 0.1 1011

Example:

Page 14: Huffman Codes

EndHuffman Codes

Analysis of Algorithms

14