SlideShare a Scribd company logo
14
Most read
15
Most read
17
Most read
NAME : NAZMUL HYDER
ID : 011 -131-085
WELCOME TO MY
PRESENTATION
Topic: Huffman Coding
Outline
✓ Definition of The Problem
✓ History
✓ Building the tree
✓ Implementation
✓Algorithm
✓Example
✓ Run Time Analysis
✓ Applications
Encoding and
Compression of Data
▶ Fax Machines
▶ ASCII
▶ Variations on ASCII
▶ min number of bits needed
▶ cost of savings
▶ patterns
▶ modifications
Purpose of Huffman
Coding
▶ Proposed by Dr. David A. Huffman in 1952
▶ “A Method for the Construction of Minimum
Redundancy Codes”
▶ Applicable to many forms of data transmission
▶ Our example: text files
Human Coding
Create New Node m
1. frequencies[m] ←
frequency1 + frequency2 // new
node
2. frequencies[node1] ← m // left link
3. frequencies[node2] ← -m // right link
4. insert in PQueue
(m, frequency1 + frequency2)
Huffman Coding
▶ As an example, lets take the string:
“Duke blue devils”
▶ We first to a frequency count of the characters:
▶ S:1, i:1, v:1, b:1, k:1, sp:2, l:2, u:2, d:2, e:3.
▶ Next we use a Greedy algorithm to build up a Huffman Tree
▶ We start with nodes for each character
e
,3
d
,2
u
,2
l,
2
s
p
,2
k,
1
b
,1
v,
1
i,
1
S,
1
Building a Tree
e
,3
d
,2
u
,2
l,
2
s
p
,2
k,
1
b
,1
v,
1
i,
1
s,
1
e
,3
d
,2
u
,2
l,
2
s
p
,2
k,
1
b
,1
v,
1
i,
1
s,
1
2
e
,3
d
,2
u
,2
l,
2
s
p
,2
k,
1
b
,1
v,
1
i,
1
s,
1
22
Building a Tree
e
,3
d
,2
u
,2
l,
2
s
p
,2
k,
1
i,
1
s,
1
2
b
,1
v,
1
2
3
e
,3
d
,2
u
,2
l,
2
s
p
,2
k,
1
i,
1
s,
1
2
b
,1
v,
1
2
3 4
Building a Tree
e
,3
d
,2
u
,2
l,
2
s
p
,2
k,
1
i,
1
s,
1
2
b
,1
v,
1
2
3 4 4
e
,3
d
,2
u
,2
l,
2
s
p
,2
k,
1
i,
1
s,
1
2
b
,1
v,
1
2
3
44 5
Building a Tree
e
,3
d
,2
u
,2
l,
2
s
p
,2
k,
1
i,
1
s,
1
2
b
,1
v,
1
2
3
4
4
5 7
Building a Tree
e
,3
d
,2
u
,2
l,
2
s
p
,2
k,
1
i,
1
s,
1
2
b
,1
v,
1
2
3
44 5
7 9
Building a Tree
e
,3
d
,2
u
,2
l,
2
s
p
,2
k,
1
i,
1
s,
1
2
b
,1
v,
1
2
3
44 5
7 9
1
6
Huffman Coding
▶ Once receiver has tree it scans incoming bit stream
▶ 0 Go left.
▶ 1 Go right.
▶ Note that no code is the prefix of another code
Huffman Coding
e
,3
d
,2
u
,2
l,
2
s
p
,2
k,
1
i,
1
s,
1
2
b
,1
v,
1
2
3
44 5
7 9
1
6
e 00
d 010
u 011
l 100
sp 101
i 1100
s 1101
k 1110
b 11110
v 11111
0
Encoding the String results
▶ These codes are then used to encode the string
▶ Thus, “duke blue devils” turns into 56 bits:
010 011 1110 00 101 11110 100 011 00 101 010 00 11111
1100 100 1101
▶ ASCII will take 128 bit:
01001111 10001011 11101000 11001010 10001111
11100100 1101xxxx
h If modified code used 4 bits per character are
needed. Total bits
4 * 16 = 64. Savings not as great
▶ Thus it takes 7 bytes of space compared to 16
characters * 1 byte/char = 16 bytes uncompressed
▶ Total save=128-56=72.
Running Time
16
Time efficiency of building the Huffman
tree
The insert and delete operations each
take log(N) time, and they are repeated
at most 2N times
Therefore the run time is O(2NlogN) =
O(NlogN)
Real-Life Applications
That’s it.
Thank you

More Related Content

PPTX
Huffman Coding Algorithm Presentation
PPTX
Matrix chain multiplication
PPT
Sensors, Proximity sensors. Optical – Through-beam, Optical - Diffuse
PDF
Error detection & correction codes
PPTX
Dynamic programming
PPSX
Kotlin Language powerpoint show file
PPT
Huffman Coding
PPTX
Introduction to Data Science
Huffman Coding Algorithm Presentation
Matrix chain multiplication
Sensors, Proximity sensors. Optical – Through-beam, Optical - Diffuse
Error detection & correction codes
Dynamic programming
Kotlin Language powerpoint show file
Huffman Coding
Introduction to Data Science

What's hot (20)

PPTX
The n Queen Problem
PPTX
Priority Queue in Data Structure
PPT
Intermediate code generation (Compiler Design)
PDF
A* Search Algorithm
PPTX
Three Address code
PPTX
Input-Buffering
PDF
Algorithms Lecture 7: Graph Algorithms
PPTX
Graph coloring using backtracking
PPTX
8 queens problem using back tracking
PPTX
0 1 knapsack using branch and bound
PPT
Compiler Design Unit 5
PPTX
Cohen sutherland line clipping
PPTX
heap Sort Algorithm
PPTX
Huffman codes
PDF
I. AO* SEARCH ALGORITHM
PPTX
Data structure - Graph
PDF
Symbol table in compiler Design
PPTX
Chess board problem(divide and conquer)
PPTX
Code generation
PPTX
N queen problem
The n Queen Problem
Priority Queue in Data Structure
Intermediate code generation (Compiler Design)
A* Search Algorithm
Three Address code
Input-Buffering
Algorithms Lecture 7: Graph Algorithms
Graph coloring using backtracking
8 queens problem using back tracking
0 1 knapsack using branch and bound
Compiler Design Unit 5
Cohen sutherland line clipping
heap Sort Algorithm
Huffman codes
I. AO* SEARCH ALGORITHM
Data structure - Graph
Symbol table in compiler Design
Chess board problem(divide and conquer)
Code generation
N queen problem
Ad

Similar to Huffman coding (20)

PPT
Hufman coding basic
PPTX
Huffman.pptx
PDF
INRODUCTION TO DATA COMPRESSION and ENCRYPTION: Concepts and need
PDF
Huffman Encoding Algorithm - Concepts and Example
PPTX
Huffman Coding
PDF
UNIT 3.2 Classical and Modern Encryption Techniques.pdf
PPT
Jaimin chp-8 - network security-new -use this - 2011 batch
PPTX
CH02-CompSec4e.pptx
PPTX
Cryptography in discrete structure .pptx
PPT
computer notes - Data Structures - 24
PDF
The Back Propagation Learning Algorithm
PDF
02-Language of the Computer.pdf wewe kaka de papa
PDF
cp467_12_lecture14_image compression1.pdf
PPT
CCNA Security 012- cryptographic systems
PPTX
Document Analysis with Deep Learning
PDF
Lab report assembly
PPTX
Thread safety
PPTX
lec20111111111111111111111111111111111111.pptx
PDF
Shan.pdfFully Homomorphic Encryption (FHE)
PDF
[Slides] A simple (leveled) fully homomorphic encryption scheme and thoughts ...
Hufman coding basic
Huffman.pptx
INRODUCTION TO DATA COMPRESSION and ENCRYPTION: Concepts and need
Huffman Encoding Algorithm - Concepts and Example
Huffman Coding
UNIT 3.2 Classical and Modern Encryption Techniques.pdf
Jaimin chp-8 - network security-new -use this - 2011 batch
CH02-CompSec4e.pptx
Cryptography in discrete structure .pptx
computer notes - Data Structures - 24
The Back Propagation Learning Algorithm
02-Language of the Computer.pdf wewe kaka de papa
cp467_12_lecture14_image compression1.pdf
CCNA Security 012- cryptographic systems
Document Analysis with Deep Learning
Lab report assembly
Thread safety
lec20111111111111111111111111111111111111.pptx
Shan.pdfFully Homomorphic Encryption (FHE)
[Slides] A simple (leveled) fully homomorphic encryption scheme and thoughts ...
Ad

More from Nazmul Hyder (10)

PPTX
Analysis of Tree in Computer Based Application
PDF
Classification by clustering
PPTX
Language Translator ( Compiler)
PPTX
Linux Shell Scripts and Shell Commands✌️
PPTX
Dataset Analysis using weka tools (pattern recognition)
PDF
ODOO documentation(e-commerce +accounting+purchase+inventory+invoice+HR+ POS)
PPTX
E-commerce (System Analysis and Design)
PPTX
Benchmark analysis (Online Shopping System)
PPTX
Online medicine store (using ODOO)
PPTX
Data analysis in artificial intelligence
Analysis of Tree in Computer Based Application
Classification by clustering
Language Translator ( Compiler)
Linux Shell Scripts and Shell Commands✌️
Dataset Analysis using weka tools (pattern recognition)
ODOO documentation(e-commerce +accounting+purchase+inventory+invoice+HR+ POS)
E-commerce (System Analysis and Design)
Benchmark analysis (Online Shopping System)
Online medicine store (using ODOO)
Data analysis in artificial intelligence

Recently uploaded (20)

PDF
Basic Mud Logging Guide for educational purpose
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
RMMM.pdf make it easy to upload and study
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Pre independence Education in Inndia.pdf
PDF
Classroom Observation Tools for Teachers
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Insiders guide to clinical Medicine.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Basic Mud Logging Guide for educational purpose
TR - Agricultural Crops Production NC III.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
RMMM.pdf make it easy to upload and study
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
STATICS OF THE RIGID BODIES Hibbelers.pdf
Final Presentation General Medicine 03-08-2024.pptx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Pre independence Education in Inndia.pdf
Classroom Observation Tools for Teachers
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Microbial disease of the cardiovascular and lymphatic systems
Renaissance Architecture: A Journey from Faith to Humanism
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
VCE English Exam - Section C Student Revision Booklet
Insiders guide to clinical Medicine.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester

Huffman coding