SlideShare a Scribd company logo
1 of 11
Presented to:-
Sir Sufi Ullah
Presented by:-
Sonia Murtza 14024198-043
________________________________
Faculty of Computer Science & Information Technology
University of Gujarat
Session 2014-2018
Topic
Huffman code
Contents
 Introduction
 Steps to build the Huffman code
 Example
 conclusion
Introduction
 Operational and transactional systems are the new generation systems which are different
from 1970’s decision support systems (DSS). In order to complete the life cycle, DSS
needs the shadow of a Data Warehouse (DW). This system represents a good base for
 analysis and predictions in the following time period for the purpose of quality business
decision-making by top management.
Business Problem:-
Business Problem Energy trading systems for a variety of
submarkets were not integrated. The majority of reporting features
were detailed and fragmented. The business needed a
consolidated, multi-level aggregation of trading transaction data, as
well as a full array of risk measures for Value at Risk and Market-to-
Market analysis.
Steps to build Huffman Tree
Input is array of unique characters along with their frequency of oc
1. Create a leaf node for each unique character and build a min heap of all
leaf nodes (Min Heap is used as a priority queue. The value of frequency
field is used to compare two nodes in min heap. Initially, the least
frequent character is at root)
2. Extract two nodes with the minimum frequency from the min heap.
3. Create a new internal node with frequency equal to the sum of the two
nodes frequencies. Make the first extracted node as its left child and the
other extracted node as its right child. Add this node to the min heap.
4. Repeat steps#2 and #3 until the heap contains only one node. The
remaining node is the root node and the tree is complete currences and
output is Huffman Tree.
Example:-
character Frequency
a 5
b 9
c 12
d 13
e 16
f 45
Solution
 Step 1. Build a min heap that contains 6 nodes where each node represents root
of a tree with single node.
 Step 2 Extract two minimum frequency nodes from min heap. Add a new
internal node with frequency 5 + 9 = 14.
Now min heap contains 5 nodes where 4 nodes are roots of trees with single
element each, and one heap node is root of tree with 3 elements
 character Frequency c 12 d 13 Internal Node 14 e 16 f 45
 Step 3: Extract two minimum frequency nodes from heap. Add a new internal
node with frequency 12 + 13 = 25
continue
 Now min heap contains 4 nodes where 2 nodes are roots of trees with single
element each, and two heap nodes are root of tree with more than one
nodes.
 character Frequency Internal Node 14 e 16 Internal Node 25 f 45
 Step 4: Extract two minimum frequency nodes. Add a new internal node
with frequency 14 + 16 = 30
Now min heap contains 3 nodes.
 character Frequency Internal Node 25 Internal Node 30 f 45
 Step 5: Extract two minimum frequency nodes. Add a new internal node
with frequency 25 + 30 = 55
 Now min heap contains 2 nodes.
 character Frequency f 45 Internal Node 55
 Step 6: Extract two minimum frequency nodes. Add a new internal node with frequency 45
+ 55 = 100
 Now min heap contains only one node.
 character Frequency Internal Node 100Since the heap contains only one node, the algorithm
stops here.
 Steps to print codes from Huffman Tree:
Traverse the tree formed starting from the root. Maintain an auxiliary array. While moving
to the left child, write 0 to the array.
 While moving to the right child, write 1 to the array. Print the array when a leaf node is
encountered.
Conclusion
 The codes are as follows:
 character code-word f 0 c 100 d 101 a 1100 b 1101 e 111
 Like many other useful algorithms we do require Huffman Algorithm
for compression of data so it could be transmitted over internet and
other transmission channels properly. Huffman algorithm works on
Binary trees.

More Related Content

Similar to Ppt of discrete structure copy - copy - copy

MPerceptron
MPerceptronMPerceptron
MPerceptron
butest
 

Similar to Ppt of discrete structure copy - copy - copy (20)

1.10.association mining 2
1.10.association mining 21.10.association mining 2
1.10.association mining 2
 
Fp growth
Fp growthFp growth
Fp growth
 
GSP 215 Entire Course NEW
GSP 215 Entire Course NEWGSP 215 Entire Course NEW
GSP 215 Entire Course NEW
 
DATA STRUCTURE.pdf
DATA STRUCTURE.pdfDATA STRUCTURE.pdf
DATA STRUCTURE.pdf
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
 
Digital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-IDigital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-I
 
computer operating system:Greedy algorithm
computer operating system:Greedy algorithmcomputer operating system:Greedy algorithm
computer operating system:Greedy algorithm
 
Lec 6-bp
Lec 6-bpLec 6-bp
Lec 6-bp
 
Daa chapter4
Daa chapter4Daa chapter4
Daa chapter4
 
algorithm
algorithmalgorithm
algorithm
 
MPerceptron
MPerceptronMPerceptron
MPerceptron
 
Chapter 4 pc
Chapter 4 pcChapter 4 pc
Chapter 4 pc
 
01 Notes Introduction Analysis of Algorithms Notes
01 Notes Introduction Analysis of Algorithms Notes01 Notes Introduction Analysis of Algorithms Notes
01 Notes Introduction Analysis of Algorithms Notes
 
Problem solving techniques in c language
Problem solving techniques in c languageProblem solving techniques in c language
Problem solving techniques in c language
 
IRJET- Hadoop based Frequent Closed Item-Sets for Association Rules form ...
IRJET-  	  Hadoop based Frequent Closed Item-Sets for Association Rules form ...IRJET-  	  Hadoop based Frequent Closed Item-Sets for Association Rules form ...
IRJET- Hadoop based Frequent Closed Item-Sets for Association Rules form ...
 
A High Speed Transposed Form FIR Filter Using Floating Point Dadda Multiplier
A High Speed Transposed Form FIR Filter Using Floating Point Dadda MultiplierA High Speed Transposed Form FIR Filter Using Floating Point Dadda Multiplier
A High Speed Transposed Form FIR Filter Using Floating Point Dadda Multiplier
 
running stable diffusion on android
running stable diffusion on androidrunning stable diffusion on android
running stable diffusion on android
 
Lecture 7.pptx
Lecture 7.pptxLecture 7.pptx
Lecture 7.pptx
 
Hufman coding basic
Hufman coding basicHufman coding basic
Hufman coding basic
 
Dsp lab pdf
Dsp lab pdfDsp lab pdf
Dsp lab pdf
 

Recently uploaded

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 

Recently uploaded (20)

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Post office management system project ..pdf
Post office management system project ..pdfPost office management system project ..pdf
Post office management system project ..pdf
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .ppt
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Path loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelPath loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata Model
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor
 
Memory Interfacing of 8086 with DMA 8257
Memory Interfacing of 8086 with DMA 8257Memory Interfacing of 8086 with DMA 8257
Memory Interfacing of 8086 with DMA 8257
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 

Ppt of discrete structure copy - copy - copy

  • 1. Presented to:- Sir Sufi Ullah Presented by:- Sonia Murtza 14024198-043 ________________________________ Faculty of Computer Science & Information Technology University of Gujarat Session 2014-2018
  • 3. Contents  Introduction  Steps to build the Huffman code  Example  conclusion
  • 4. Introduction  Operational and transactional systems are the new generation systems which are different from 1970’s decision support systems (DSS). In order to complete the life cycle, DSS needs the shadow of a Data Warehouse (DW). This system represents a good base for  analysis and predictions in the following time period for the purpose of quality business decision-making by top management.
  • 5. Business Problem:- Business Problem Energy trading systems for a variety of submarkets were not integrated. The majority of reporting features were detailed and fragmented. The business needed a consolidated, multi-level aggregation of trading transaction data, as well as a full array of risk measures for Value at Risk and Market-to- Market analysis.
  • 6. Steps to build Huffman Tree Input is array of unique characters along with their frequency of oc 1. Create a leaf node for each unique character and build a min heap of all leaf nodes (Min Heap is used as a priority queue. The value of frequency field is used to compare two nodes in min heap. Initially, the least frequent character is at root) 2. Extract two nodes with the minimum frequency from the min heap. 3. Create a new internal node with frequency equal to the sum of the two nodes frequencies. Make the first extracted node as its left child and the other extracted node as its right child. Add this node to the min heap. 4. Repeat steps#2 and #3 until the heap contains only one node. The remaining node is the root node and the tree is complete currences and output is Huffman Tree.
  • 7. Example:- character Frequency a 5 b 9 c 12 d 13 e 16 f 45
  • 8. Solution  Step 1. Build a min heap that contains 6 nodes where each node represents root of a tree with single node.  Step 2 Extract two minimum frequency nodes from min heap. Add a new internal node with frequency 5 + 9 = 14. Now min heap contains 5 nodes where 4 nodes are roots of trees with single element each, and one heap node is root of tree with 3 elements  character Frequency c 12 d 13 Internal Node 14 e 16 f 45  Step 3: Extract two minimum frequency nodes from heap. Add a new internal node with frequency 12 + 13 = 25
  • 9. continue  Now min heap contains 4 nodes where 2 nodes are roots of trees with single element each, and two heap nodes are root of tree with more than one nodes.  character Frequency Internal Node 14 e 16 Internal Node 25 f 45  Step 4: Extract two minimum frequency nodes. Add a new internal node with frequency 14 + 16 = 30 Now min heap contains 3 nodes.  character Frequency Internal Node 25 Internal Node 30 f 45  Step 5: Extract two minimum frequency nodes. Add a new internal node with frequency 25 + 30 = 55
  • 10.  Now min heap contains 2 nodes.  character Frequency f 45 Internal Node 55  Step 6: Extract two minimum frequency nodes. Add a new internal node with frequency 45 + 55 = 100  Now min heap contains only one node.  character Frequency Internal Node 100Since the heap contains only one node, the algorithm stops here.  Steps to print codes from Huffman Tree: Traverse the tree formed starting from the root. Maintain an auxiliary array. While moving to the left child, write 0 to the array.  While moving to the right child, write 1 to the array. Print the array when a leaf node is encountered.
  • 11. Conclusion  The codes are as follows:  character code-word f 0 c 100 d 101 a 1100 b 1101 e 111  Like many other useful algorithms we do require Huffman Algorithm for compression of data so it could be transmitted over internet and other transmission channels properly. Huffman algorithm works on Binary trees.