SlideShare a Scribd company logo
Huffman Code
Introduction & Example
Introduction to the Huffman
algorithm
By : Subaita Ahmed, 2006566
Definition
David A. Huffman, while he was a Sc.D. student at MIT invented a
greedy algorithm that constructs an optimal prefix code for the
purpose of lossless data compression, this specific algorithm is called
the Huffman code.
-Introduction to Algorithms, CLRS
Terminology
Greedy Algorithm : A solution which always takes the locally optimal
choice in the hope that this choice will lead to a globally optimal
solution.
Data compression : The process of encoding, restructuring or otherwise
modifying data in order to reduce its size. Fundamentally, it involves re-
encoding information using fewer bits than the original representation.
Applications
Huffman encoding is widely used in compression formats like WINZIP
Multimedia codecs like JPEG, PNG and MP3 use Huffman encoding
Cloud systems and servers use Huffman code to compress data and
save valuable storage space
Huffman encoding still dominates the compression industry since
newer schemes are avoided due to their patent issues.
Implementation & approach
By : Anish Kumar Mohanty, 2006109
Encoding
1. Create a leaf node for each symbol and add it to the priority queue.
2. While there is more than one node in the queue:
2.1 : Remove the two nodes of highest priority from the queue.
2.2 : Create a new internal node with these two nodes as
children and with frequency equal to the sum of the two nodes' frequency.
2.3 : Add the new node to the queue.
3. The remaining node is the root node and the Huffman tree is complete.
Formula
The total number of bits required to encode a file of characters is given
as the summation of the product of each character’s frequency with its
depth in the Huffman tree.
Decoding
The process of decompression is simply a matter of translating the
stream of prefix codes to individual byte value, usually by traversing the
Huffman tree node by node as each bit is read from the input stream.
Reaching a leaf node necessarily terminates the search for that
particular byte value. The leaf value represents the desired character.
Example & Explanation
By :
Om Shree, 2006077
Niraj Kumar Sah, 2006562
Dhruvam Dhruvil, 2006213
Problem statement
For a given frequency table of characters determine :-
1. The Huffman code for each character
2. Average code length
3. Total length of Huffman encoded message (in bits)
The given frequency table :-
Step 1
Leaf node corresponding to each character is created :-
These nodes are stored in a queue(sorted from least to greatest)
Step 2
2 nodes with max priority are removed from the queue and added to our
binary tree
Step 3 : A new node is created whose frequency is the sum of the
frequency of our root node and that of the max priority node
Step 4 : Steps 2 and 3 are being repeated
Recurring steps 2 and 3 :
Recurring steps 2 and 3 :
Recurring steps 2 and 3 : We’ve reached our final Huffman tree
Decoding phase 1 :-
Finding out the average code length:-
Finding out the total length of code :-
THANK YOU !
The presentation on Huffman code has been concluded, we hope you enjoyed.

More Related Content

What's hot

COMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time EnvironmentsCOMPILER DESIGN Run-Time Environments
SHA 1 Algorithm
SHA 1 AlgorithmSHA 1 Algorithm
SHA 1 Algorithm
Shiva RamDam
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languages
parmeet834
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
LINEAR BOUNDED AUTOMATA (LBA).pptx
LINEAR BOUNDED AUTOMATA (LBA).pptxLINEAR BOUNDED AUTOMATA (LBA).pptx
LINEAR BOUNDED AUTOMATA (LBA).pptx
AkhilJoseph63
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
Rahul Narang
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
Dipankar Boruah
 
Peephole Optimization
Peephole OptimizationPeephole Optimization
Peephole Optimization
United International University
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
Prof. Dr. K. Adisesha
 
Lexical analysis
Lexical analysisLexical analysis
Lexical analysis
Richa Sharma
 
Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOC
AbhayDhupar
 
Undecidability.pptx
Undecidability.pptxUndecidability.pptx
Undecidability.pptx
PEzhumalai
 
Bootstrapping in Compiler
Bootstrapping in CompilerBootstrapping in Compiler
Bootstrapping in Compiler
Akhil Kaushik
 
Theory of computation / Post’s Correspondence Problems (PCP)
Theory of computation / Post’s Correspondence Problems (PCP)Theory of computation / Post’s Correspondence Problems (PCP)
Theory of computation / Post’s Correspondence Problems (PCP)
Technical Advisor at Iraqi Government
 
Lzw compression
Lzw compressionLzw compression
Lzw compression
Meghna Singh
 
String matching algorithms
String matching algorithmsString matching algorithms
String matching algorithms
Ashikapokiya12345
 
Software Engineering (Testing techniques)
Software Engineering (Testing techniques)Software Engineering (Testing techniques)
Software Engineering (Testing techniques)
ShudipPal
 
Congestion control in TCP
Congestion control in TCPCongestion control in TCP
Congestion control in TCP
selvakumar_b1985
 
Huffman Encoding Pr
Huffman Encoding PrHuffman Encoding Pr
Huffman Encoding Pr
anithabalaprabhu
 
Simplification of cfg ppt
Simplification of cfg pptSimplification of cfg ppt
Simplification of cfg ppt
Shiela Rani
 

What's hot (20)

COMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time EnvironmentsCOMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time Environments
 
SHA 1 Algorithm
SHA 1 AlgorithmSHA 1 Algorithm
SHA 1 Algorithm
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languages
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
LINEAR BOUNDED AUTOMATA (LBA).pptx
LINEAR BOUNDED AUTOMATA (LBA).pptxLINEAR BOUNDED AUTOMATA (LBA).pptx
LINEAR BOUNDED AUTOMATA (LBA).pptx
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
 
Peephole Optimization
Peephole OptimizationPeephole Optimization
Peephole Optimization
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
 
Lexical analysis
Lexical analysisLexical analysis
Lexical analysis
 
Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOC
 
Undecidability.pptx
Undecidability.pptxUndecidability.pptx
Undecidability.pptx
 
Bootstrapping in Compiler
Bootstrapping in CompilerBootstrapping in Compiler
Bootstrapping in Compiler
 
Theory of computation / Post’s Correspondence Problems (PCP)
Theory of computation / Post’s Correspondence Problems (PCP)Theory of computation / Post’s Correspondence Problems (PCP)
Theory of computation / Post’s Correspondence Problems (PCP)
 
Lzw compression
Lzw compressionLzw compression
Lzw compression
 
String matching algorithms
String matching algorithmsString matching algorithms
String matching algorithms
 
Software Engineering (Testing techniques)
Software Engineering (Testing techniques)Software Engineering (Testing techniques)
Software Engineering (Testing techniques)
 
Congestion control in TCP
Congestion control in TCPCongestion control in TCP
Congestion control in TCP
 
Huffman Encoding Pr
Huffman Encoding PrHuffman Encoding Pr
Huffman Encoding Pr
 
Simplification of cfg ppt
Simplification of cfg pptSimplification of cfg ppt
Simplification of cfg ppt
 

Similar to Huffman ppt

Chapter%202%20 %20 Text%20compression(2)
Chapter%202%20 %20 Text%20compression(2)Chapter%202%20 %20 Text%20compression(2)
Chapter%202%20 %20 Text%20compression(2)
nes
 
j001adcpresentation-2112170415 23.pdf
j001adcpresentation-2112170415      23.pdfj001adcpresentation-2112170415      23.pdf
j001adcpresentation-2112170415 23.pdf
HarshSharma71048
 
Text compression
Text compressionText compression
Text compression
Sammer Qader
 
Sunzip user tool for data reduction using huffman algorithm
Sunzip user tool for data reduction using huffman algorithmSunzip user tool for data reduction using huffman algorithm
Sunzip user tool for data reduction using huffman algorithm
Dr Sandeep Kumar Poonia
 
Hash Function & Analysis
Hash Function & AnalysisHash Function & Analysis
Hash Function & Analysis
Pawandeep Kaur
 
Huffman Coding
Huffman CodingHuffman Coding
Huffman Coding
Ehtisham Ali
 
A research paper_on_lossless_data_compre
A research paper_on_lossless_data_compreA research paper_on_lossless_data_compre
A research paper_on_lossless_data_compre
Luisa Francisco
 
Hufman coding basic
Hufman coding basicHufman coding basic
Hufman coding basic
radthees
 
Ch12
Ch12Ch12
DSA Presentetion Huffman tree.pdf
DSA Presentetion Huffman tree.pdfDSA Presentetion Huffman tree.pdf
DSA Presentetion Huffman tree.pdf
GaneshPawar819187
 
Data representation
Data representationData representation
Data representation
Travis Leong Ping
 
Data representation
Data representationData representation
Data representation
Travis Leong Ping
 
Moein
MoeinMoein
Paper id 24201469
Paper id 24201469Paper id 24201469
Paper id 24201469
IJRAT
 
Lossless
LosslessLossless
Lossless
LosslessLossless
Lossless
Vishal Suri
 
Develop and design hybrid genetic algorithms with multiple objectives in data...
Develop and design hybrid genetic algorithms with multiple objectives in data...Develop and design hybrid genetic algorithms with multiple objectives in data...
Develop and design hybrid genetic algorithms with multiple objectives in data...
khalil IBRAHIM
 
Data compression
Data  compressionData  compression
Data compression
Ashutosh Kawadkar
 
Data encryption algorithm(edit)
Data encryption algorithm(edit)Data encryption algorithm(edit)
Data encryption algorithm(edit)
Hussain Almohammadi
 
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
Helan4
 

Similar to Huffman ppt (20)

Chapter%202%20 %20 Text%20compression(2)
Chapter%202%20 %20 Text%20compression(2)Chapter%202%20 %20 Text%20compression(2)
Chapter%202%20 %20 Text%20compression(2)
 
j001adcpresentation-2112170415 23.pdf
j001adcpresentation-2112170415      23.pdfj001adcpresentation-2112170415      23.pdf
j001adcpresentation-2112170415 23.pdf
 
Text compression
Text compressionText compression
Text compression
 
Sunzip user tool for data reduction using huffman algorithm
Sunzip user tool for data reduction using huffman algorithmSunzip user tool for data reduction using huffman algorithm
Sunzip user tool for data reduction using huffman algorithm
 
Hash Function & Analysis
Hash Function & AnalysisHash Function & Analysis
Hash Function & Analysis
 
Huffman Coding
Huffman CodingHuffman Coding
Huffman Coding
 
A research paper_on_lossless_data_compre
A research paper_on_lossless_data_compreA research paper_on_lossless_data_compre
A research paper_on_lossless_data_compre
 
Hufman coding basic
Hufman coding basicHufman coding basic
Hufman coding basic
 
Ch12
Ch12Ch12
Ch12
 
DSA Presentetion Huffman tree.pdf
DSA Presentetion Huffman tree.pdfDSA Presentetion Huffman tree.pdf
DSA Presentetion Huffman tree.pdf
 
Data representation
Data representationData representation
Data representation
 
Data representation
Data representationData representation
Data representation
 
Moein
MoeinMoein
Moein
 
Paper id 24201469
Paper id 24201469Paper id 24201469
Paper id 24201469
 
Lossless
LosslessLossless
Lossless
 
Lossless
LosslessLossless
Lossless
 
Develop and design hybrid genetic algorithms with multiple objectives in data...
Develop and design hybrid genetic algorithms with multiple objectives in data...Develop and design hybrid genetic algorithms with multiple objectives in data...
Develop and design hybrid genetic algorithms with multiple objectives in data...
 
Data compression
Data  compressionData  compression
Data compression
 
Data encryption algorithm(edit)
Data encryption algorithm(edit)Data encryption algorithm(edit)
Data encryption algorithm(edit)
 
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
 

Recently uploaded

cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
SakkaravarthiShanmug
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
architagupta876
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
shadow0702a
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
ElakkiaU
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
gowrishankartb2005
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
Prakhyath Rai
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
RamonNovais6
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
riddhimaagrawal986
 
Data Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptxData Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptx
ramrag33
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 

Recently uploaded (20)

cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
 
Data Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptxData Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptx
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 

Huffman ppt

  • 2. Introduction to the Huffman algorithm By : Subaita Ahmed, 2006566
  • 3. Definition David A. Huffman, while he was a Sc.D. student at MIT invented a greedy algorithm that constructs an optimal prefix code for the purpose of lossless data compression, this specific algorithm is called the Huffman code. -Introduction to Algorithms, CLRS
  • 4. Terminology Greedy Algorithm : A solution which always takes the locally optimal choice in the hope that this choice will lead to a globally optimal solution. Data compression : The process of encoding, restructuring or otherwise modifying data in order to reduce its size. Fundamentally, it involves re- encoding information using fewer bits than the original representation.
  • 5. Applications Huffman encoding is widely used in compression formats like WINZIP Multimedia codecs like JPEG, PNG and MP3 use Huffman encoding Cloud systems and servers use Huffman code to compress data and save valuable storage space Huffman encoding still dominates the compression industry since newer schemes are avoided due to their patent issues.
  • 6. Implementation & approach By : Anish Kumar Mohanty, 2006109
  • 7. Encoding 1. Create a leaf node for each symbol and add it to the priority queue. 2. While there is more than one node in the queue: 2.1 : Remove the two nodes of highest priority from the queue. 2.2 : Create a new internal node with these two nodes as children and with frequency equal to the sum of the two nodes' frequency. 2.3 : Add the new node to the queue. 3. The remaining node is the root node and the Huffman tree is complete.
  • 8. Formula The total number of bits required to encode a file of characters is given as the summation of the product of each character’s frequency with its depth in the Huffman tree.
  • 9. Decoding The process of decompression is simply a matter of translating the stream of prefix codes to individual byte value, usually by traversing the Huffman tree node by node as each bit is read from the input stream. Reaching a leaf node necessarily terminates the search for that particular byte value. The leaf value represents the desired character.
  • 10. Example & Explanation By : Om Shree, 2006077 Niraj Kumar Sah, 2006562 Dhruvam Dhruvil, 2006213
  • 11. Problem statement For a given frequency table of characters determine :- 1. The Huffman code for each character 2. Average code length 3. Total length of Huffman encoded message (in bits)
  • 13. Step 1 Leaf node corresponding to each character is created :- These nodes are stored in a queue(sorted from least to greatest)
  • 14. Step 2 2 nodes with max priority are removed from the queue and added to our binary tree
  • 15. Step 3 : A new node is created whose frequency is the sum of the frequency of our root node and that of the max priority node
  • 16. Step 4 : Steps 2 and 3 are being repeated
  • 17. Recurring steps 2 and 3 :
  • 18. Recurring steps 2 and 3 :
  • 19. Recurring steps 2 and 3 : We’ve reached our final Huffman tree
  • 20.
  • 22. Finding out the average code length:-
  • 23. Finding out the total length of code :-
  • 24. THANK YOU ! The presentation on Huffman code has been concluded, we hope you enjoyed.