SlideShare una empresa de Scribd logo
1 de 44
Huffman Coding:  An Application of Binary Trees and Priority Queues CS 102
Encoding and Compression of Data ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],CS 102
Purpose of Huffman Coding ,[object Object],[object Object],[object Object],[object Object],CS 102
The Basic Algorithm ,[object Object],[object Object],[object Object],[object Object],CS 102
The Basic Algorithm ,[object Object],[object Object],[object Object],CS 102
The (Real) Basic Algorithm CS 102 ,[object Object],[object Object],[object Object],[object Object],[object Object]
Building a Tree Scan the original text ,[object Object],[object Object],[object Object],CS 102
Building a Tree Scan the original text ,[object Object],[object Object],CS 102 E  e  r  i space  y s n a r l k .
Building a Tree Scan the original text ,[object Object],[object Object],CS 102 Char Freq.  Char Freq.  Char Freq. E  1   y 1   k 1 e  8   s  2   . 1 r  2   n  2   i  1   a 2 space  4   l 1
Building a Tree Prioritize characters ,[object Object],[object Object],[object Object],CS 102
Building a Tree Prioritize characters ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],CS 102
Building a Tree ,[object Object],[object Object],CS 102 E 1 i 1 y 1 l 1 k 1 . 1 r 2 s 2 n 2 a 2 sp 4 e 8
Building a Tree ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],CS 102
Building a Tree CS 102 E 1 i 1 y 1 l 1 k 1 . 1 r 2 s 2 n 2 a 2 sp 4 e 8
Building a Tree CS 102 E 1 i 1 y 1 l 1 k 1 . 1 r 2 s 2 n 2 a 2 sp 4 e 8 2
Building a Tree CS 102 E 1 i 1 y 1 l 1 k 1 . 1 r 2 s 2 n 2 a 2 sp 4 e 8 2
Building a Tree CS 102 E 1 i 1 k 1 . 1 r 2 s 2 n 2 a 2 sp 4 e 8 2 y 1 l 1 2
Building a Tree CS 102 E 1 i 1 k 1 . 1 r 2 s 2 n 2 a 2 sp 4 e 8 2 y 1 l 1 2
Building a Tree CS 102 E 1 i 1 r 2 s 2 n 2 a 2 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2
Building a Tree CS 102 E 1 i 1 r 2 s 2 n 2 a 2 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2
Building a Tree CS 102 E 1 i 1 n 2 a 2 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4
Building a Tree CS 102 E 1 i 1 n 2 a 2 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 What is happening to the characters with a low number of occurrences?
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10 16
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10 16
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10 16 26
Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10 16 26 ,[object Object]
Building a Tree CS 102 Dequeue the single node left in the queue. This tree contains the new code words for each character. Frequency of root node should equal number of characters in text. Eerie eyes seen near lake.    26 characters E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10 16 26
Encoding the File Traverse Tree for Codes ,[object Object],[object Object],[object Object],CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10 16 26
Encoding the File Traverse Tree for Codes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10 16 26
Encoding the File ,[object Object],[object Object],CS 102 Char Code E 0000 i 0001 y 0010 l 0011 k 0100 . 0101 space 011 e 10 r 1100 s 1101 n 1110 a 1111 0000101100000110011100010101101101001111101011111100011001111110100100101 ,[object Object],[object Object]
Encoding the File Results ,[object Object],[object Object],[object Object],CS 102 0000101100000110011100010101101101001111101011111100011001111110100100101 ,[object Object],[object Object],[object Object]
Decoding the File ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],CS 102
Decoding the File ,[object Object],[object Object],[object Object],CS 102 10100011011110111101111110000110101 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10 16 26
Summary ,[object Object],[object Object],[object Object],[object Object],[object Object],CS 102

Más contenido relacionado

La actualidad más candente

Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsDivide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsAmrinder Arora
 
Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFAkunj desai
 
1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressionsSampath Kumar S
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmGaurav Kolekar
 
Scan scheduling 50 1
Scan scheduling 50 1Scan scheduling 50 1
Scan scheduling 50 1myrajendra
 
heap Sort Algorithm
heap  Sort Algorithmheap  Sort Algorithm
heap Sort AlgorithmLemia Algmri
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examplesgreatqadirgee4u
 
Introduction to Computer theory Daniel Cohen Chapter 4 & 5 Solutions
Introduction to Computer theory Daniel Cohen Chapter 4 & 5 SolutionsIntroduction to Computer theory Daniel Cohen Chapter 4 & 5 Solutions
Introduction to Computer theory Daniel Cohen Chapter 4 & 5 SolutionsAshu
 
Algorithms Lecture 5: Sorting Algorithms II
Algorithms Lecture 5: Sorting Algorithms IIAlgorithms Lecture 5: Sorting Algorithms II
Algorithms Lecture 5: Sorting Algorithms IIMohamed Loey
 
WT(WEB TECHNOLOGY) previous year question papers
WT(WEB TECHNOLOGY) previous year question papersWT(WEB TECHNOLOGY) previous year question papers
WT(WEB TECHNOLOGY) previous year question papersHemaArora2
 

La actualidad más candente (20)

Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsDivide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
 
Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFA
 
Disjoint sets
Disjoint setsDisjoint sets
Disjoint sets
 
Red black tree
Red black treeRed black tree
Red black tree
 
1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithm
 
Huffman coding
Huffman coding Huffman coding
Huffman coding
 
Np cooks theorem
Np cooks theoremNp cooks theorem
Np cooks theorem
 
Red black trees
Red black treesRed black trees
Red black trees
 
Kruskal's algorithm
Kruskal's algorithmKruskal's algorithm
Kruskal's algorithm
 
Automata Theory
Automata TheoryAutomata Theory
Automata Theory
 
Presentation-Merge Sort
Presentation-Merge SortPresentation-Merge Sort
Presentation-Merge Sort
 
Merge sort
Merge sortMerge sort
Merge sort
 
Scan scheduling 50 1
Scan scheduling 50 1Scan scheduling 50 1
Scan scheduling 50 1
 
heap Sort Algorithm
heap  Sort Algorithmheap  Sort Algorithm
heap Sort Algorithm
 
Kruskal Algorithm
Kruskal AlgorithmKruskal Algorithm
Kruskal Algorithm
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
 
Introduction to Computer theory Daniel Cohen Chapter 4 & 5 Solutions
Introduction to Computer theory Daniel Cohen Chapter 4 & 5 SolutionsIntroduction to Computer theory Daniel Cohen Chapter 4 & 5 Solutions
Introduction to Computer theory Daniel Cohen Chapter 4 & 5 Solutions
 
Algorithms Lecture 5: Sorting Algorithms II
Algorithms Lecture 5: Sorting Algorithms IIAlgorithms Lecture 5: Sorting Algorithms II
Algorithms Lecture 5: Sorting Algorithms II
 
WT(WEB TECHNOLOGY) previous year question papers
WT(WEB TECHNOLOGY) previous year question papersWT(WEB TECHNOLOGY) previous year question papers
WT(WEB TECHNOLOGY) previous year question papers
 

Destacado

Huffman and Arithmetic coding - Performance analysis
Huffman and Arithmetic coding - Performance analysisHuffman and Arithmetic coding - Performance analysis
Huffman and Arithmetic coding - Performance analysisRamakant Soni
 

Destacado (6)

Huffman coding
Huffman codingHuffman coding
Huffman coding
 
Huffman codes
Huffman codesHuffman codes
Huffman codes
 
Huffman and Arithmetic coding - Performance analysis
Huffman and Arithmetic coding - Performance analysisHuffman and Arithmetic coding - Performance analysis
Huffman and Arithmetic coding - Performance analysis
 
Adaptive Huffman Coding
Adaptive Huffman CodingAdaptive Huffman Coding
Adaptive Huffman Coding
 
Huffman Coding
Huffman CodingHuffman Coding
Huffman Coding
 
Huffman Coding
Huffman CodingHuffman Coding
Huffman Coding
 

Similar a Huffman Coding Explained: Binary Trees and Priority Queues for Data Compression

CS-102 Data Structures huffman coding.pdf
CS-102 Data Structures huffman coding.pdfCS-102 Data Structures huffman coding.pdf
CS-102 Data Structures huffman coding.pdfssuser034ce1
 
CS-102 Data Structures huffman coding.pdf
CS-102 Data Structures huffman coding.pdfCS-102 Data Structures huffman coding.pdf
CS-102 Data Structures huffman coding.pdfssuser034ce1
 
huffman algoritm upload for understand.ppt
huffman algoritm upload for understand.ppthuffman algoritm upload for understand.ppt
huffman algoritm upload for understand.pptSadiaSharmin40
 
huffman codes and algorithm
huffman codes and algorithm huffman codes and algorithm
huffman codes and algorithm Vinay379568
 
Data Structure and Algorithms Huffman Coding Algorithm
Data Structure and Algorithms Huffman Coding AlgorithmData Structure and Algorithms Huffman Coding Algorithm
Data Structure and Algorithms Huffman Coding AlgorithmManishPrajapati78
 
Huffman Tree And Its Application
Huffman Tree And Its ApplicationHuffman Tree And Its Application
Huffman Tree And Its ApplicationPapu Kumar
 
Huffman > Data Structures & Algorithums
Huffman > Data Structures & AlgorithumsHuffman > Data Structures & Algorithums
Huffman > Data Structures & AlgorithumsAin-ul-Moiz Khawaja
 
Linking E-Mails and Source Code Artifacts
Linking E-Mails and Source Code ArtifactsLinking E-Mails and Source Code Artifacts
Linking E-Mails and Source Code ArtifactsAlberto Bacchelli
 
[Perforce] Tasks - The Holy Hand Grenade of Branching
[Perforce] Tasks - The Holy Hand Grenade of Branching[Perforce] Tasks - The Holy Hand Grenade of Branching
[Perforce] Tasks - The Holy Hand Grenade of BranchingPerforce
 
Computer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption StandardComputer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption StandardMohamed Loey
 
Unit2 test flashcards
Unit2 test flashcardsUnit2 test flashcards
Unit2 test flashcardsThomasVizza
 
Greedy Algorithms Huffman Coding.ppt
Greedy Algorithms  Huffman Coding.pptGreedy Algorithms  Huffman Coding.ppt
Greedy Algorithms Huffman Coding.pptRuchika Sinha
 
Cassandra introduction mars jug
Cassandra introduction mars jugCassandra introduction mars jug
Cassandra introduction mars jugDuyhai Doan
 
Farhana shaikh webinar_huffman coding
Farhana shaikh webinar_huffman codingFarhana shaikh webinar_huffman coding
Farhana shaikh webinar_huffman codingFarhana Shaikh
 
A Deep Dive Into Understanding Apache Cassandra
A Deep Dive Into Understanding Apache CassandraA Deep Dive Into Understanding Apache Cassandra
A Deep Dive Into Understanding Apache CassandraDataStax Academy
 

Similar a Huffman Coding Explained: Binary Trees and Priority Queues for Data Compression (20)

CS-102 Data Structures huffman coding.pdf
CS-102 Data Structures huffman coding.pdfCS-102 Data Structures huffman coding.pdf
CS-102 Data Structures huffman coding.pdf
 
CS-102 Data Structures huffman coding.pdf
CS-102 Data Structures huffman coding.pdfCS-102 Data Structures huffman coding.pdf
CS-102 Data Structures huffman coding.pdf
 
Data compession
Data compession Data compession
Data compession
 
huffman algoritm upload for understand.ppt
huffman algoritm upload for understand.ppthuffman algoritm upload for understand.ppt
huffman algoritm upload for understand.ppt
 
huffman codes and algorithm
huffman codes and algorithm huffman codes and algorithm
huffman codes and algorithm
 
Huffman
HuffmanHuffman
Huffman
 
Data Structure and Algorithms Huffman Coding Algorithm
Data Structure and Algorithms Huffman Coding AlgorithmData Structure and Algorithms Huffman Coding Algorithm
Data Structure and Algorithms Huffman Coding Algorithm
 
Huffman
HuffmanHuffman
Huffman
 
Huffman Tree And Its Application
Huffman Tree And Its ApplicationHuffman Tree And Its Application
Huffman Tree And Its Application
 
Huffman tree
Huffman tree Huffman tree
Huffman tree
 
Huffman.pptx
Huffman.pptxHuffman.pptx
Huffman.pptx
 
Huffman > Data Structures & Algorithums
Huffman > Data Structures & AlgorithumsHuffman > Data Structures & Algorithums
Huffman > Data Structures & Algorithums
 
Linking E-Mails and Source Code Artifacts
Linking E-Mails and Source Code ArtifactsLinking E-Mails and Source Code Artifacts
Linking E-Mails and Source Code Artifacts
 
[Perforce] Tasks - The Holy Hand Grenade of Branching
[Perforce] Tasks - The Holy Hand Grenade of Branching[Perforce] Tasks - The Holy Hand Grenade of Branching
[Perforce] Tasks - The Holy Hand Grenade of Branching
 
Computer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption StandardComputer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption Standard
 
Unit2 test flashcards
Unit2 test flashcardsUnit2 test flashcards
Unit2 test flashcards
 
Greedy Algorithms Huffman Coding.ppt
Greedy Algorithms  Huffman Coding.pptGreedy Algorithms  Huffman Coding.ppt
Greedy Algorithms Huffman Coding.ppt
 
Cassandra introduction mars jug
Cassandra introduction mars jugCassandra introduction mars jug
Cassandra introduction mars jug
 
Farhana shaikh webinar_huffman coding
Farhana shaikh webinar_huffman codingFarhana shaikh webinar_huffman coding
Farhana shaikh webinar_huffman coding
 
A Deep Dive Into Understanding Apache Cassandra
A Deep Dive Into Understanding Apache CassandraA Deep Dive Into Understanding Apache Cassandra
A Deep Dive Into Understanding Apache Cassandra
 

Más de anithabalaprabhu (20)

Shannon Fano
Shannon FanoShannon Fano
Shannon Fano
 
Ch 04 Arithmetic Coding ( P P T)
Ch 04  Arithmetic  Coding ( P P T)Ch 04  Arithmetic  Coding ( P P T)
Ch 04 Arithmetic Coding ( P P T)
 
Compression
CompressionCompression
Compression
 
Datacompression1
Datacompression1Datacompression1
Datacompression1
 
Speech Compression
Speech CompressionSpeech Compression
Speech Compression
 
Z24 4 Speech Compression
Z24   4   Speech CompressionZ24   4   Speech Compression
Z24 4 Speech Compression
 
Dictor
DictorDictor
Dictor
 
Dictionary Based Compression
Dictionary Based CompressionDictionary Based Compression
Dictionary Based Compression
 
Module 4 Arithmetic Coding
Module 4 Arithmetic CodingModule 4 Arithmetic Coding
Module 4 Arithmetic Coding
 
Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)
 
Compression Ii
Compression IiCompression Ii
Compression Ii
 
06 Arithmetic 1
06 Arithmetic 106 Arithmetic 1
06 Arithmetic 1
 
Arithmetic Coding
Arithmetic CodingArithmetic Coding
Arithmetic Coding
 
Lassy
LassyLassy
Lassy
 
Compression Ii
Compression IiCompression Ii
Compression Ii
 
Lossy
LossyLossy
Lossy
 
Planning
PlanningPlanning
Planning
 
Lossless
LosslessLossless
Lossless
 
Losseless
LosselessLosseless
Losseless
 
Lec32
Lec32Lec32
Lec32
 

Último

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Último (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

Huffman Coding Explained: Binary Trees and Priority Queues for Data Compression

  • 1. Huffman Coding: An Application of Binary Trees and Priority Queues CS 102
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14. Building a Tree CS 102 E 1 i 1 y 1 l 1 k 1 . 1 r 2 s 2 n 2 a 2 sp 4 e 8
  • 15. Building a Tree CS 102 E 1 i 1 y 1 l 1 k 1 . 1 r 2 s 2 n 2 a 2 sp 4 e 8 2
  • 16. Building a Tree CS 102 E 1 i 1 y 1 l 1 k 1 . 1 r 2 s 2 n 2 a 2 sp 4 e 8 2
  • 17. Building a Tree CS 102 E 1 i 1 k 1 . 1 r 2 s 2 n 2 a 2 sp 4 e 8 2 y 1 l 1 2
  • 18. Building a Tree CS 102 E 1 i 1 k 1 . 1 r 2 s 2 n 2 a 2 sp 4 e 8 2 y 1 l 1 2
  • 19. Building a Tree CS 102 E 1 i 1 r 2 s 2 n 2 a 2 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2
  • 20. Building a Tree CS 102 E 1 i 1 r 2 s 2 n 2 a 2 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2
  • 21. Building a Tree CS 102 E 1 i 1 n 2 a 2 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4
  • 22. Building a Tree CS 102 E 1 i 1 n 2 a 2 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4
  • 23. Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4
  • 24. Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4
  • 25. Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4
  • 26. Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4
  • 27. Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6
  • 28. Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 What is happening to the characters with a low number of occurrences?
  • 29. Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8
  • 30. Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8
  • 31. Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10
  • 32. Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10
  • 33. Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10 16
  • 34. Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10 16
  • 35. Building a Tree CS 102 E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10 16 26
  • 36.
  • 37. Building a Tree CS 102 Dequeue the single node left in the queue. This tree contains the new code words for each character. Frequency of root node should equal number of characters in text. Eerie eyes seen near lake.  26 characters E 1 i 1 sp 4 e 8 2 y 1 l 1 2 k 1 . 1 2 r 2 s 2 4 n 2 a 2 4 4 6 8 10 16 26
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.

Notas del editor

  1. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  2. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  3. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  4. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  5. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  6. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  7. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  8. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  9. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  10. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  11. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  12. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  13. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  14. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  15. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  16. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  17. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  18. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  19. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  20. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  21. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  22. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  23. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  24. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  25. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  26. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  27. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  28. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  29. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  30. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  31. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  32. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  33. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  34. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  35. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  36. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  37. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  38. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  39. An Introduction to Huffman Coding March 21, 2000 Mike Scott
  40. An Introduction to Huffman Coding March 21, 2000 Mike Scott