Download presentation
Presentation is loading. Please wait.
Published byMelinda Fowler Modified over 9 years ago
1
Huffman Coding and Decoding TAIABUL HAQUE NAEEMUL HASSAN
2
Huffman Encoding An encoding algorithm used for lossless data compression- Variable-length code Prefix code Basic Intuition- Those symbols that are more frequent should have smaller codes A special kind of tree called Huffman Tree is built by exploiting this property
3
Huffman Tree Creation CharacterFrequency A29 E23 I25 O14 U7
4
Huffman Tree Creation CharacterFrequency A29 E23 I25 O14 U7 7 232529
5
Huffman Tree Creation CharacterFrequency A29 E23 I25 O14 U7 U(7)O(14) 21 232925
6
Huffman Tree Creation CharacterFrequency A29 E23 I25 O14 U7 U(7)O(14) 21 E(23) 44 252944
7
Huffman Tree Creation CharacterFrequency A29 E23 I25 O14 U7 U(7)O(14) 21 E(23) 44 I(25)A(29) 54 44
8
Huffman Tree Creation CharacterFrequency A29 E23 I25 O14 U7 U(7)O(14) 21 E(23) 44 I(25)A(29) 54 98
9
Start Accept training data Scan data, keep tally Make prioritized list Create, Draw Tree Traverse tree Determine code words Save code words Accept test sentence Encode with lookup Display encoded string Decode with traversal Display decoded string Calculate comp. ratio End
10
Start Accept training data Scan data, keep tally Make prioritized list Create, Draw Tree Traverse tree Determine code words Save code words Accept test sentence Encode with lookup Display encoded string Decode with traversal Display decoded string Calculate comp. ratio End
12
analysis of algorithm
13
a(3)
14
Start Accept training data Scan data, keep tally Make prioritized list Create, Draw Tree Traverse tree Determine code words Save code words Accept test sentence Encode with lookup Display encoded string Decode with traversal Display decoded string Calculate comp. ratio End
15
Start Accept training data Scan data, keep tally Make prioritized list Create, Draw Tree Traverse tree Determine code words Save code words Accept test sentence Encode with lookup Display encoded string Calculate comp. ratio Decode with traversal Display decoded string End
17
algo = 4 * 8 = 32 bits 10101100011110 = 14 bits Compression Ratio = 14/32*100 = 43.75
18
Start Accept training data Scan data, keep tally Make prioritized list Create, Draw Tree Traverse tree Determine code words Save code words Accept test sentence Encode with lookup Display encoded string Calculate comp. ratio Decode with traversal Display decoded string End
20
10101100011110
21
a(3)
22
10101100011110 l(2)
23
10101100011110 g(1)
24
10101100011110 o(2)
25
Frequency Analysis E T A O I N S H R D L U is the approximate order of frequency of the twelve most commonly used letters in the English language. Our Observation: File SizeOrder of letters 338E T I A O N S R C H L D 65E T N O I A R S C L H D 70E A O T R S I N L H D C 8E O T A N R I S L H U D 677E T A O N I R S H L D C
26
THANK YOU
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.