SlideShare ist ein Scribd-Unternehmen logo
1 von 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.

Weitere ähnliche Inhalte

Ähnlich wie Ppt of discrete structure copy - copy - copy

MPerceptron
MPerceptronMPerceptron
MPerceptron
butest
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 

Kürzlich hochgeladen (20)

ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 

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.