SlideShare a Scribd company logo
VISVESVARAYA TECHNOLOGICAL UNIVERSITY
“JNANA SANGAMA” , BELAGAVI– 590018
PRESENTED BY
AKSHRA RANI (1AT21IS009)
HRITIKA DUTTA (1AT21IS047)
IRAM KHAN (1AT21IS050)
TITLE
“ HUFFMAN TREE”
UNDER THE GUIDANCE OF
Dr. Jyoti Metan
Dept. of ISE, Atria IT
ATRIA INSTITUTE OF TECHNOLOGY
BANGALORE-54, Karnataka
DEPARTMENT OF INFORMATION SCIENCE &
ENGINEERING
INTRODUCTION
NEED FOR EFFICIENT COMPRESSION
BASICS COMPONENTS OF HUFFMAN TREE
HUFFMAN ALGORITHM
IMPLEMENTATION OF AN HUFFMAN TREE
ENCODING WITH HUFFMAN TREE
DECODING WITH HUFFMAN TREE
REAL WORLD APPLICATION
CONCLUSION
CONTENTS
INTRODUCTION
• A huffman tree, also known as a huffman coding tree or huffman binary tree, is a data structure
used in computer science and information theory for data compression.
• It's a specific type of binary tree that's used to generate huffman codes, which are variable-length
codes used to represent characters or symbols in a way that minimizes the overall data size when
encoding.
• Huffman coding is commonly used in various data compression algorithms, such as those used in
zip files and jpeg images, to reduce the size of data for efficient storage and transmission.
• Huffman trees are of significant importance in data compression for several
reasons:
1. EFFICIENT VARIABLE-LENGTH ENCODING: huffman coding provides a variable-
length encoding scheme where frequently occurring symbols are assigned shorter
codes, and less frequent symbols are assigned longer codes. this efficient mapping
of symbols to codes helps reduce the average number of bits required to represent
the data, resulting in compression.
2. LOSSLESS COMPRESSION: huffman coding is a lossless compression technique,
meaning that no information is lost during the compression-decompression process.
it ensures that the original data can be perfectly reconstructed from the compressed
data.
3. ADAPTABILITY: huffman coding can adapt to the frequency distribution of symbols
within the data. if the data changes, and the frequencies of symbols change, a new
huffman tree can be constructed to generate updated codes. this adaptability makes
it suitable for a wide range of data types
4. WIDELY USED: huffman coding is used in many popular compression algorithms and
formats, such as zip files, png images, and mp3 audio compression. it plays a crucial role
in reducing the size of files for storage and transmission while maintaining data integrity.
5. MINIMAL REDUNDANCY: huffman coding minimizes redundancy in the encoded data. by
assigning shorter codes to frequently occurring symbols, it reduces the overall number of
bits required to represent the data, making it an efficient compression technique.
6. SIMPLE AND FAST: huffman encoding and decoding are relatively simple and fast
operations, making it suitable for real-time applications and scenarios where
computational resources are limited.
NEED FOR EFFICIENT COMPRESSION
1. REDUCED STORAGE SPACE: compression reduces the amount of space required to
store data. this is critical in scenarios where storage is limited or expensive, such as on
hard drives, solid-state drives, cloud storage, or mobile devices. by compressing data, you
can store more information in the same amount of space.
2. FASTER DATA TRANSFER: compressed data can be transmitted more quickly over
networks or the internet. smaller data sizes mean reduced bandwidth usage and faster
download or upload times, which is crucial for efficient data communication.
3. IMPROVED PERFORMANCE: compressed data can be read from storage devices faster,
as reading smaller files takes less time. this can lead to improved system and application
performance.
4. REAL-TIME STREAMING: in applications like video streaming and online gaming, data
compression allows for smoother real-time delivery of content by reducing latency and
ensuring a consistent user experience.
5. Backup and Archiving: Compression is often used in backup and archiving
solutions to save space and reduce the time needed for backups. It also helps
preserve historical data efficiently.
6. Web Content:* Websites use compression to minimize page load times.
Technologies like GZIP compression reduce the size of HTML, CSS, and JavaScript
files before sending them to web browsers, resulting in faster website loading.
7. Security: In some cases, data compression can enhance security. For example,
encrypted data can be compressed before transmission to reduce the amount of
information available to potential eavesdroppers.
8. Data Analysis: In scientific and big data applications, data compression can help
manage a nd analyze vast datasets more efficiently, making it easier to extract
insights and patterns from the data.
BASIC COMPONENTS OF HUFFMAN TREE
The fundamental components of a huffman tree include:
• NODES: a huffman tree is composed of nodes, each of which represents either a character
or a composite node. composite nodes are formed by combining two nodes from the
previous level of the tree.
• LEAVES: the leaf nodes of a huffman tree represent individual characters or symbols from
the input data. each leaf node contains a character and its frequency count in the dataset.
• INTERNAL NODES: internal nodes, also known as composite nodes or branch nodes, are
not associated with characters directly. instead, they represent the merging of two nodes
from the previous level. these nodes have no character associated with them but have a
cumulative frequency that is the sum of the frequencies of their child nodes
• EDGES: edges connect the nodes in the huffman tree, forming a hierarchical
structure. each edge represents a binary decision, with a left edge typically
representing a "0" and a right edge representing a "1" in the huffman coding.
• ROOT NODE: the topmost node in the huffman tree is called the root node. it is the
starting point for traversing the tree when encoding or decoding data. The root node
has no parent node
• HUFFMAN CODES: the Huffman codes are generated by traversing the tree from
the root to the leaf nodes. These codes are binary representations of characters, with
shorter codes assigned to more frequently occurring characters and longer codes
assigned to less frequent ones.
• FREQUENCY COUNTS: associated with each leaf node, there are frequency counts
that indicate how many times each character appears in the input data. These
frequency counts are essential for constructing the Huffman tree and determining the
code lengths.
HUFFMAN ALGORITHM
CREATING A HUFFMAN TREE INVOLVES THE FOLLOWING ALGORITHM:
1. Calculate the frequency of each character in the input data.
2. Create a leaf node for each character with its frequency as the weight, and add them
to a priority queue (min-heap) based on their frequencies.
3. While there is more than one node in the queue:
A. Remove the two nodes with the lowest frequencies from the queue.
B. Create a new internal node with a weight equal to the sum of the frequencies of
the two nodes removed in step 3a.
4. Add the new internal node to the queue.4. the remaining node in the queue is the root
of the huffman tree.
IMPLEMENTATION OF HUFFMAN TREE
CHARACTERS FREQUENCIES
a 10
e 15
i 12
o 3
u 4
s 13
t 1
EXAMPLE: -
STEP 1:-
Create a leaf node for the given table and arrange them
in ascending order according to their frequency
1 3 4 10 1
2
13 15
t o u a i s e
1
0
15 1
2
3 4 13 1
a e i o u s t
STEP 2:-
Add the minimum two nodes and arrange them in ascending order
1 3
4 10 1
2
13 15
t o
u a i s e
4
1 3 4 10 1
2
13 15
t o u a i s e
STEP 3:-
Repeat step-2 until all the elements are added to the root node.
1 3
4 10 1
2
13 15
t o
u a i s e
4
1 3
4
10 1
2
13 15
t o
u
a i s e
4
8
STEP 4:-
1 3
4
10 1
2
13 15
t o
u
a i s e
4
8
1 3
4
10
1
2
13 15
t o
u
a
i s e
4
8
18
Arranging in ascending order:-
1 3
4
10
1
2
13 15
t o
u
a
i s e
4
8
18
STEP 5:-
1 3
4
10
1
2
13 15
t o
u
a
i s e
4
8
18
1 3
4
10
1
2
13
15
t o
u
a
i s
e
4
8
18
25
1 3
4
10 1
2
13
15
t o
u
a i s
e
4
8
18 25
STEP 6:-
1 3
4
10 1
2
13
15
t o
u
a i s
e
4
8
18 25
1 3
4
10
1
2
13
15
t o
u
a
i s
e
4
8
18
25
33
1 3
4
10
1
2
13
15
t o
u
a
i s
e
4
8
18
25
33
STEP 7:-
1 3
4
10
1
2
13
15
t o
u
a
i s
e
4
8
18
25
33
1 3
4
10
1
2
13
15
t o
u
a
i s
e
4
8
18
25 33
58
HUFFMAN TREE
1 3
4
10
1
2
13
15
u
a
i s
e
4
8
18
25 33
58
Assigning Weights
0
0
0
0
0
0
1
1
1
1
1
1
ENCODING WITH HUFFMAN TREE
CHARACTER CODE
a 111
e 10
i 00
o 11001
u 1101
s 01
t 11000
Examples:-
sat – 0111111000
01 111 11000
s a t
eat – 1011111000
to – 1100011001
out – 11001110111000
DECODING WITH HUFFMAN TREE
CHARACTER CODE
a 111
e 10
i 00
o 11001
u 1101
s 01
t 11000
Examples:-
 010011000 – sit
01 00 11000
s i t
 11111000 – at
 01101100001 – sets
 1111100010 - ate
REAL WORLD APPLICATION
GENERIC FILE COMPRESSION:
 FILES:GZIP,BZIP,7Z
 ARCHIVERS:PKZIP
 FILE SYSTEMS: NTFS, ZFS
MULTIMEDIA:
 IMAGES: GIF,JPEG
 SOUND: MP3
 VIDEO: HDTV,MPEG
CONCLUSION
To conclude on the topic of binary huffman tree, we like to state some points on it which will help you understand
better:
• Universal applicability: huffman trees are a versatile and universally applicable tool in the realm of data
compression and coding. their ability to adapt to various types of data, including text, images, audio, and more,
makes them a valuable asset in a wide range of applications.
• Efficiency and resource savings: huffman coding excels in efficiently utilizing resources, particularly in
scenarios where bandwidth and storage are limited. by assigning shorter codes to frequently occurring
symbols, it minimizes waste and optimizes resource usage.
• Lossless data preservation: huffman coding lossless compression ensures that data integrity remains intact
throughout the encoding and decoding process. this makes it an ideal choice for archiving, data transmission,
and any situation where data fidelity is critical.
• Human readable and understandable: huffman codes are binary, but they are still human-readable and easily
understandable. this characteristic simplifies debugging, analysis, and manual inspection of encoded data,
making it a practical choice in various contexts.
• Education and algorithmic understanding: learning about huffman trees provides a valuable insight
into fundamental computer science concepts, including binary tree structures, priority queues, and
greedy algorithms. it serves as an excellent starting point for those interested in algorithm design and
data compression.
In conclusion, huffman trees are a versatile, efficient, and educational tool with a long-standing legacy in
data compression. they offer lossless compression, resource optimization, adaptability, and human-
readable codes, making them valuable in diverse applications and serving as an essential building block
in the world of data compression and coding.
DAA PPT.pptx

More Related Content

PDF
A research paper_on_lossless_data_compre
Luisa Francisco
 
PDF
Compression Using Wavelet Transform
CSCJournals
 
PPT
Lecture 2 computer evolution and performance
Wajahat HuxaIn
 
PDF
Robust Speech Recognition Technique using Mat lab
IRJET Journal
 
PPTX
Huffman Coding
Muhammad Saqib Rehan
 
PDF
FORECASTING MUSIC GENRE (RNN - LSTM)
IRJET Journal
 
PPTX
Chapter 5
edmondhuat
 
PPTX
Next-generation sequencing data format and visualization with ngs.plot 2015
Li Shen
 
A research paper_on_lossless_data_compre
Luisa Francisco
 
Compression Using Wavelet Transform
CSCJournals
 
Lecture 2 computer evolution and performance
Wajahat HuxaIn
 
Robust Speech Recognition Technique using Mat lab
IRJET Journal
 
Huffman Coding
Muhammad Saqib Rehan
 
FORECASTING MUSIC GENRE (RNN - LSTM)
IRJET Journal
 
Chapter 5
edmondhuat
 
Next-generation sequencing data format and visualization with ngs.plot 2015
Li Shen
 

Similar to DAA PPT.pptx (20)

PDF
Optimal Communication Of Real Time Data On Secure Cdma Ip...
Stefanie Yang
 
PPTX
Data representation
Travis Leong Ping
 
PPTX
Data representation
Travis Leong Ping
 
PDF
Emf2179 ib _devicenet aif module__v3-0__en
Charles Santos
 
PDF
Oss forensics fosscomm_2011
fangjiafu
 
PDF
IRJET- Voice based Gender Recognition
IRJET Journal
 
PPT
Chapter%202%20 %20 Text%20compression(2)
nes
 
PDF
CSE491_Computer_Interfacing_and_Peripherals_Lec1.pdf
ajf3215
 
PPT
NETTING THE SET: WORKSHOP FOR LIBRARIANS & LIS STUDENTS
Sarika Sawant
 
PDF
FINAL PROJECT REPORT
Dhrumil Shah
 
PDF
Software Defined Radio Handbook 8th Edition Rodger H Hosking
conaldobanor
 
PPT
111111111111111111111111111111111789.ppt
AllamJayaPrakash
 
PPT
111111111111111111111111111111111789.ppt
AllamJayaPrakash
 
PDF
State-Of-The Art Machine Learning Algorithms and How They Are Affected By Nea...
inside-BigData.com
 
PPTX
data compression.
hasan sarker
 
DOC
Design of an Efficient FFT Processor ffor DAB System
ZunAib Ali
 
PDF
GENDER RECOGNITION SYSTEM USING SPEECH SIGNAL
IJCSEIT Journal
 
PDF
A METHOD FOR ENCRYPTING AND DECRYPTINGWAVE FILES
IJNSA Journal
 
PDF
Comparision Of Various Lossless Image Compression Techniques
IJERA Editor
 
Optimal Communication Of Real Time Data On Secure Cdma Ip...
Stefanie Yang
 
Data representation
Travis Leong Ping
 
Data representation
Travis Leong Ping
 
Emf2179 ib _devicenet aif module__v3-0__en
Charles Santos
 
Oss forensics fosscomm_2011
fangjiafu
 
IRJET- Voice based Gender Recognition
IRJET Journal
 
Chapter%202%20 %20 Text%20compression(2)
nes
 
CSE491_Computer_Interfacing_and_Peripherals_Lec1.pdf
ajf3215
 
NETTING THE SET: WORKSHOP FOR LIBRARIANS & LIS STUDENTS
Sarika Sawant
 
FINAL PROJECT REPORT
Dhrumil Shah
 
Software Defined Radio Handbook 8th Edition Rodger H Hosking
conaldobanor
 
111111111111111111111111111111111789.ppt
AllamJayaPrakash
 
111111111111111111111111111111111789.ppt
AllamJayaPrakash
 
State-Of-The Art Machine Learning Algorithms and How They Are Affected By Nea...
inside-BigData.com
 
data compression.
hasan sarker
 
Design of an Efficient FFT Processor ffor DAB System
ZunAib Ali
 
GENDER RECOGNITION SYSTEM USING SPEECH SIGNAL
IJCSEIT Journal
 
A METHOD FOR ENCRYPTING AND DECRYPTINGWAVE FILES
IJNSA Journal
 
Comparision Of Various Lossless Image Compression Techniques
IJERA Editor
 
Ad

Recently uploaded (20)

PDF
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
PDF
July 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
PPTX
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
PDF
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
PPT
SCOPE_~1- technology of green house and poyhouse
bala464780
 
PDF
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
PDF
Software Testing Tools - names and explanation
shruti533256
 
PDF
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
PPTX
easa module 3 funtamental electronics.pptx
tryanothert7
 
PDF
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
PDF
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
PDF
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
DOCX
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
PDF
JUAL EFIX C5 IMU GNSS GEODETIC PERFECT BASE OR ROVER
Budi Minds
 
PDF
The Effect of Artifact Removal from EEG Signals on the Detection of Epileptic...
Partho Prosad
 
PPTX
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
PPTX
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
PDF
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
PPTX
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
July 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
SCOPE_~1- technology of green house and poyhouse
bala464780
 
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
Software Testing Tools - names and explanation
shruti533256
 
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
easa module 3 funtamental electronics.pptx
tryanothert7
 
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
JUAL EFIX C5 IMU GNSS GEODETIC PERFECT BASE OR ROVER
Budi Minds
 
The Effect of Artifact Removal from EEG Signals on the Detection of Epileptic...
Partho Prosad
 
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
Ad

DAA PPT.pptx

  • 1. VISVESVARAYA TECHNOLOGICAL UNIVERSITY “JNANA SANGAMA” , BELAGAVI– 590018 PRESENTED BY AKSHRA RANI (1AT21IS009) HRITIKA DUTTA (1AT21IS047) IRAM KHAN (1AT21IS050) TITLE “ HUFFMAN TREE” UNDER THE GUIDANCE OF Dr. Jyoti Metan Dept. of ISE, Atria IT ATRIA INSTITUTE OF TECHNOLOGY BANGALORE-54, Karnataka DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
  • 2. INTRODUCTION NEED FOR EFFICIENT COMPRESSION BASICS COMPONENTS OF HUFFMAN TREE HUFFMAN ALGORITHM IMPLEMENTATION OF AN HUFFMAN TREE ENCODING WITH HUFFMAN TREE DECODING WITH HUFFMAN TREE REAL WORLD APPLICATION CONCLUSION CONTENTS
  • 3. INTRODUCTION • A huffman tree, also known as a huffman coding tree or huffman binary tree, is a data structure used in computer science and information theory for data compression. • It's a specific type of binary tree that's used to generate huffman codes, which are variable-length codes used to represent characters or symbols in a way that minimizes the overall data size when encoding. • Huffman coding is commonly used in various data compression algorithms, such as those used in zip files and jpeg images, to reduce the size of data for efficient storage and transmission.
  • 4. • Huffman trees are of significant importance in data compression for several reasons: 1. EFFICIENT VARIABLE-LENGTH ENCODING: huffman coding provides a variable- length encoding scheme where frequently occurring symbols are assigned shorter codes, and less frequent symbols are assigned longer codes. this efficient mapping of symbols to codes helps reduce the average number of bits required to represent the data, resulting in compression. 2. LOSSLESS COMPRESSION: huffman coding is a lossless compression technique, meaning that no information is lost during the compression-decompression process. it ensures that the original data can be perfectly reconstructed from the compressed data. 3. ADAPTABILITY: huffman coding can adapt to the frequency distribution of symbols within the data. if the data changes, and the frequencies of symbols change, a new huffman tree can be constructed to generate updated codes. this adaptability makes it suitable for a wide range of data types
  • 5. 4. WIDELY USED: huffman coding is used in many popular compression algorithms and formats, such as zip files, png images, and mp3 audio compression. it plays a crucial role in reducing the size of files for storage and transmission while maintaining data integrity. 5. MINIMAL REDUNDANCY: huffman coding minimizes redundancy in the encoded data. by assigning shorter codes to frequently occurring symbols, it reduces the overall number of bits required to represent the data, making it an efficient compression technique. 6. SIMPLE AND FAST: huffman encoding and decoding are relatively simple and fast operations, making it suitable for real-time applications and scenarios where computational resources are limited.
  • 6. NEED FOR EFFICIENT COMPRESSION 1. REDUCED STORAGE SPACE: compression reduces the amount of space required to store data. this is critical in scenarios where storage is limited or expensive, such as on hard drives, solid-state drives, cloud storage, or mobile devices. by compressing data, you can store more information in the same amount of space. 2. FASTER DATA TRANSFER: compressed data can be transmitted more quickly over networks or the internet. smaller data sizes mean reduced bandwidth usage and faster download or upload times, which is crucial for efficient data communication. 3. IMPROVED PERFORMANCE: compressed data can be read from storage devices faster, as reading smaller files takes less time. this can lead to improved system and application performance. 4. REAL-TIME STREAMING: in applications like video streaming and online gaming, data compression allows for smoother real-time delivery of content by reducing latency and ensuring a consistent user experience.
  • 7. 5. Backup and Archiving: Compression is often used in backup and archiving solutions to save space and reduce the time needed for backups. It also helps preserve historical data efficiently. 6. Web Content:* Websites use compression to minimize page load times. Technologies like GZIP compression reduce the size of HTML, CSS, and JavaScript files before sending them to web browsers, resulting in faster website loading. 7. Security: In some cases, data compression can enhance security. For example, encrypted data can be compressed before transmission to reduce the amount of information available to potential eavesdroppers. 8. Data Analysis: In scientific and big data applications, data compression can help manage a nd analyze vast datasets more efficiently, making it easier to extract insights and patterns from the data.
  • 8. BASIC COMPONENTS OF HUFFMAN TREE The fundamental components of a huffman tree include: • NODES: a huffman tree is composed of nodes, each of which represents either a character or a composite node. composite nodes are formed by combining two nodes from the previous level of the tree. • LEAVES: the leaf nodes of a huffman tree represent individual characters or symbols from the input data. each leaf node contains a character and its frequency count in the dataset. • INTERNAL NODES: internal nodes, also known as composite nodes or branch nodes, are not associated with characters directly. instead, they represent the merging of two nodes from the previous level. these nodes have no character associated with them but have a cumulative frequency that is the sum of the frequencies of their child nodes
  • 9. • EDGES: edges connect the nodes in the huffman tree, forming a hierarchical structure. each edge represents a binary decision, with a left edge typically representing a "0" and a right edge representing a "1" in the huffman coding. • ROOT NODE: the topmost node in the huffman tree is called the root node. it is the starting point for traversing the tree when encoding or decoding data. The root node has no parent node • HUFFMAN CODES: the Huffman codes are generated by traversing the tree from the root to the leaf nodes. These codes are binary representations of characters, with shorter codes assigned to more frequently occurring characters and longer codes assigned to less frequent ones. • FREQUENCY COUNTS: associated with each leaf node, there are frequency counts that indicate how many times each character appears in the input data. These frequency counts are essential for constructing the Huffman tree and determining the code lengths.
  • 10. HUFFMAN ALGORITHM CREATING A HUFFMAN TREE INVOLVES THE FOLLOWING ALGORITHM: 1. Calculate the frequency of each character in the input data. 2. Create a leaf node for each character with its frequency as the weight, and add them to a priority queue (min-heap) based on their frequencies. 3. While there is more than one node in the queue: A. Remove the two nodes with the lowest frequencies from the queue. B. Create a new internal node with a weight equal to the sum of the frequencies of the two nodes removed in step 3a. 4. Add the new internal node to the queue.4. the remaining node in the queue is the root of the huffman tree.
  • 11. IMPLEMENTATION OF HUFFMAN TREE CHARACTERS FREQUENCIES a 10 e 15 i 12 o 3 u 4 s 13 t 1 EXAMPLE: -
  • 12. STEP 1:- Create a leaf node for the given table and arrange them in ascending order according to their frequency 1 3 4 10 1 2 13 15 t o u a i s e 1 0 15 1 2 3 4 13 1 a e i o u s t
  • 13. STEP 2:- Add the minimum two nodes and arrange them in ascending order 1 3 4 10 1 2 13 15 t o u a i s e 4 1 3 4 10 1 2 13 15 t o u a i s e
  • 14. STEP 3:- Repeat step-2 until all the elements are added to the root node. 1 3 4 10 1 2 13 15 t o u a i s e 4
  • 15. 1 3 4 10 1 2 13 15 t o u a i s e 4 8
  • 16. STEP 4:- 1 3 4 10 1 2 13 15 t o u a i s e 4 8
  • 17. 1 3 4 10 1 2 13 15 t o u a i s e 4 8 18
  • 18. Arranging in ascending order:- 1 3 4 10 1 2 13 15 t o u a i s e 4 8 18
  • 19. STEP 5:- 1 3 4 10 1 2 13 15 t o u a i s e 4 8 18
  • 21. 1 3 4 10 1 2 13 15 t o u a i s e 4 8 18 25
  • 22. STEP 6:- 1 3 4 10 1 2 13 15 t o u a i s e 4 8 18 25
  • 23. 1 3 4 10 1 2 13 15 t o u a i s e 4 8 18 25 33
  • 24. 1 3 4 10 1 2 13 15 t o u a i s e 4 8 18 25 33
  • 25. STEP 7:- 1 3 4 10 1 2 13 15 t o u a i s e 4 8 18 25 33
  • 26. 1 3 4 10 1 2 13 15 t o u a i s e 4 8 18 25 33 58 HUFFMAN TREE
  • 27. 1 3 4 10 1 2 13 15 u a i s e 4 8 18 25 33 58 Assigning Weights 0 0 0 0 0 0 1 1 1 1 1 1
  • 28. ENCODING WITH HUFFMAN TREE CHARACTER CODE a 111 e 10 i 00 o 11001 u 1101 s 01 t 11000 Examples:- sat – 0111111000 01 111 11000 s a t eat – 1011111000 to – 1100011001 out – 11001110111000
  • 29. DECODING WITH HUFFMAN TREE CHARACTER CODE a 111 e 10 i 00 o 11001 u 1101 s 01 t 11000 Examples:-  010011000 – sit 01 00 11000 s i t  11111000 – at  01101100001 – sets  1111100010 - ate
  • 30. REAL WORLD APPLICATION GENERIC FILE COMPRESSION:  FILES:GZIP,BZIP,7Z  ARCHIVERS:PKZIP  FILE SYSTEMS: NTFS, ZFS MULTIMEDIA:  IMAGES: GIF,JPEG  SOUND: MP3  VIDEO: HDTV,MPEG
  • 31. CONCLUSION To conclude on the topic of binary huffman tree, we like to state some points on it which will help you understand better: • Universal applicability: huffman trees are a versatile and universally applicable tool in the realm of data compression and coding. their ability to adapt to various types of data, including text, images, audio, and more, makes them a valuable asset in a wide range of applications. • Efficiency and resource savings: huffman coding excels in efficiently utilizing resources, particularly in scenarios where bandwidth and storage are limited. by assigning shorter codes to frequently occurring symbols, it minimizes waste and optimizes resource usage. • Lossless data preservation: huffman coding lossless compression ensures that data integrity remains intact throughout the encoding and decoding process. this makes it an ideal choice for archiving, data transmission, and any situation where data fidelity is critical. • Human readable and understandable: huffman codes are binary, but they are still human-readable and easily understandable. this characteristic simplifies debugging, analysis, and manual inspection of encoded data, making it a practical choice in various contexts.
  • 32. • Education and algorithmic understanding: learning about huffman trees provides a valuable insight into fundamental computer science concepts, including binary tree structures, priority queues, and greedy algorithms. it serves as an excellent starting point for those interested in algorithm design and data compression. In conclusion, huffman trees are a versatile, efficient, and educational tool with a long-standing legacy in data compression. they offer lossless compression, resource optimization, adaptability, and human- readable codes, making them valuable in diverse applications and serving as an essential building block in the world of data compression and coding.