SlideShare a Scribd company logo
Huffman Tree Coding
Greedy Technique
1
Dr. P. Subathra
Prof/ IT
KAMARAJ College of Engg. & Tech
(AUTONOMOUS)
Madurai
Huffman Tree Coding
• Encoding
– In computer technology, encoding is the process of putting a
sequence of characters into a special format for transmission
or storage purposes.
• Code Word
– The special format that represents each character is called as
the code word
• Fixed Length Encoding
– fixed-length encoding that assigns to each symbol a bit string
of the same length m
– Eg. ASCII codes
• Variable Length Encoding
– Variable-length encoding, which assigns codewords of
different lengths to different symbols
2
Huffman Tree Coding
• Encoding
– In computer technology, encoding is the process of putting a
sequence of characters into a special format for transmission
or storage purposes.
• Code Word
– The special format that represents each character is called as
the code word
• Fixed Length Encoding
– fixed-length encoding that assigns to each symbol a bit string
of the same length m
– Eg. ASCII codes
• Variable Length Encoding
– Variable-length encoding, which assigns codewords of
different lengths to different symbols
3
Huffman Tree Coding
• Encoding
– In computer technology, encoding is the process of putting a
sequence of characters into a special format for transmission
or storage purposes.
• Code Word
– The special format that represents each character is called as
the code word
• Fixed Length Encoding
– fixed-length encoding that assigns to each symbol a bit string
of the same length m
– Eg. ASCII codes
• Variable Length Encoding
– Variable-length encoding, which assigns codewords of
different lengths to different symbols
4
Huffman Tree Coding
5
Huffman Tree Coding
Frequency of Occurrence of English Alphabets
6
Huffman Tree Coding
• Encoding
– In computer technology, encoding is the process of putting a
sequence of characters into a special format for transmission
or storage purposes.
• Code Word
– The special format that represents each character is called as
the code word
• Fixed Length Encoding
– fixed-length encoding that assigns to each symbol a bit string
of the same length m
– Eg. ASCII codes
• Variable Length Encoding
– Variable-length encoding, which assigns codewords of
different lengths to different symbols
7
Huffman Tree Coding
• Variable-length encoding assigns codewords of different lengths to
different symbols
• Eg.
E 1
A 10
P 101
Q 1010
• How to decode: 110101 ?
• How can we tell how many bits of an encoded text represent the
first ?
8
Huffman Tree Coding
• We can limit ourselves to the so-called prefix-free (or simply
prefix) codes.
• In a prefix code, no codeword is a prefix of a codeword of
another symbol.
• Eg.
E 1
A 01
P 100
Q 101
• How to decode: 10101101 ?
• 1 01 01 101  E A A Q
9
Huffman Tree Coding
Consider the five-symbol alphabet { A, B, C, D, _ }
with the following occurrence frequencies in a text
made up of these symbols:
Create a Huffman Tree and Generate the Huffman
Code.
10
Huffman Tree Coding
11
Huffman Tree Coding
12
Huffman Tree Coding
13
Huffman Tree Coding
14
Huffman Tree Coding
15
Huffman Tree Coding
16
Huffman Tree Coding
17
Huffman Tree Coding
18
Huffman Tree Coding
19
Huffman Tree Coding
20
Huffman Tree Coding
21
Huffman Tree Coding
22
Huffman Tree Coding
23
Huffman Tree Coding
24
Huffman Tree Coding
25
Huffman Tree Coding
26
Huffman Tree Coding
27
Huffman Tree Coding
28
Character Code
A
B
C
D
-
Huffman Tree Coding
29
Character Code
A 11
B
C
D
-
Huffman Tree Coding
30
Character Code
A 11
B 100
C
D
-
Huffman Tree Coding
31
Character Code
A 11
B 100
C 00
D
-
Huffman Tree Coding
32
Character Code
A 11
B 100
C 00
D 01
-
Huffman Tree Coding
33
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Encode: “DAD CAB”
D A D C A B
34
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Encode: “DAD CAB”
D A D C A B
100
35
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Encode: “DAD CAB”
D A D C A B
100 11
36
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Encode: “DAD CAB”
D A D C A B
100 11 01
37
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Encode: “DAD CAB”
D A D C A B
100 11 01 101
38
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Encode: “DAD CAB”
D A D C A B
100 11 01 101 00
39
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Encode: “DAD CAB”
D A D C A B
100 11 01 101 00 11
40
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Encode: “DAD_CAB”
D A D _ C A B
100 11 01 101 00 11 100
41
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Decode: 10011011010011100
42
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Decode: 100 11 01 101 00 11 100
B
43
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Decode: 100 11 01 101 00 11 100
B A
44
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Decode: 100 11 01 101 00 11 100
B A D
45
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Decode: 100 11 01 101 00 11 100
B A D _
46
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Decode: 100 11 01 101 00 11 100
B A D _ C
47
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Decode: 100 11 01 101 00 11 100
B A D _ C A
48
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
Decode: 100 11 01 101 00 11 100
B A D _ C A B
49
Character Code
A 11
B 100
C 00
D 01
- 101
Huffman Tree Coding
50

More Related Content

PPT
2 1 data
PDF
Fundamental Unicode in Perl
PPTX
JAVA CHARACTER SETS- FUNDAMENTALS OF JAVA
PPSX
Programming in c
PPTX
An ABNF Primer
DOCX
C programming tutorial
PPTX
The NuGram dynamic grammar language
PPTX
fundamentals of c
2 1 data
Fundamental Unicode in Perl
JAVA CHARACTER SETS- FUNDAMENTALS OF JAVA
Programming in c
An ABNF Primer
C programming tutorial
The NuGram dynamic grammar language
fundamentals of c

Similar to Huffman tree coding (20)

PPT
Huffman Coding.ppt
PPT
Huffmans code
PPT
huffman ppt
PPTX
Huffman Coding
PPTX
Farhana shaikh webinar_huffman coding
PPT
Huffman code presentation and their operation
PDF
Data communication & computer networking: Huffman algorithm
PPTX
5c. huffman coding using greedy technique.pptx
PPT
Komdat-Kompresi Data
DOCX
The assigment is overdue now. I will up the price I am willing to pa.docx
PPT
Huffman > Data Structures & Algorithums
PPT
Huffman coding presentation Sukkur iba.ppt
PPT
Data Structure and Algorithms Huffman Coding Algorithm
PPT
Huffman Tree And Its Application
PPTX
Huffman.pptx
PPT
Greedy Algorithms Huffman Coding.ppt
PPT
Hufman coding basic
PPTX
Huffman Codes
DOC
HuffmanCoding01.doc
Huffman Coding.ppt
Huffmans code
huffman ppt
Huffman Coding
Farhana shaikh webinar_huffman coding
Huffman code presentation and their operation
Data communication & computer networking: Huffman algorithm
5c. huffman coding using greedy technique.pptx
Komdat-Kompresi Data
The assigment is overdue now. I will up the price I am willing to pa.docx
Huffman > Data Structures & Algorithums
Huffman coding presentation Sukkur iba.ppt
Data Structure and Algorithms Huffman Coding Algorithm
Huffman Tree And Its Application
Huffman.pptx
Greedy Algorithms Huffman Coding.ppt
Hufman coding basic
Huffman Codes
HuffmanCoding01.doc
Ad

More from P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai (20)

PPTX
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
PPTX
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
PPTX
PDF
PDF
The stable marriage problem iterative improvement method
PDF
Maximum matching in bipartite graphs iterative improvement method
PDF
Knapsack dynamic programming formula top down (1)
PDF
PDF
Multiplication of integers & strassens matrix multiplication subi notes
PDF
Multiplication of large integers problem subi notes
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
The stable marriage problem iterative improvement method
Maximum matching in bipartite graphs iterative improvement method
Knapsack dynamic programming formula top down (1)
Multiplication of integers & strassens matrix multiplication subi notes
Multiplication of large integers problem subi notes
Ad

Recently uploaded (20)

PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Lecture Notes Electrical Wiring System Components
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Digital Logic Computer Design lecture notes
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPT
Project quality management in manufacturing
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Sustainable Sites - Green Building Construction
PPTX
UNIT 4 Total Quality Management .pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Embodied AI: Ushering in the Next Era of Intelligent Systems
Foundation to blockchain - A guide to Blockchain Tech
Model Code of Practice - Construction Work - 21102022 .pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Lecture Notes Electrical Wiring System Components
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Digital Logic Computer Design lecture notes
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
bas. eng. economics group 4 presentation 1.pptx
Project quality management in manufacturing
R24 SURVEYING LAB MANUAL for civil enggi
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Sustainable Sites - Green Building Construction
UNIT 4 Total Quality Management .pptx

Huffman tree coding