SlideShare a Scribd company logo
Shannon-Fano Algorithm
Variable Length Coding
Introduction
The Shannon-Fano algorithm was independently developed by Shannon at Bell Labs
and Robert Fana at MIT.
The encoding steps of the Shannon-Fano algorithm can be presented in the following
top-down manner:
1. Sort the symbols according to the frequency count of their occurrences.
2. Recursively divide the symbols into two parts, each with approximately the same
number of counts, until an parts contain only one symbol.
A natural way of implementing the above procedure is to build a binary tree. As a
convention, let's assign bit 0 to its left branches and 1 to the right branches.
Example
Symbols to be coded are the characters in the word SPEAKER.
The frequency count of the symbols is
Total number of symbols is 7
S 1
P 1
E 2
A 1
K 1
R 1
E,S:(3) P,A,K,R:(4)
(7)E 2
S 1
P 1
A 1
K 1
R 1
STEP 1
STEP 2.1
0 1
The first division yields two parts: (a) E,S with a total count of 3, denoted as E,S:(3); and (b) P,A,Kand R: with a
total count of 4, denoted as P,A,K,R:(4).
E,S: (3) P,A,K,R: (4)
(7)
STEP 2.2
E:(2) S: (1) P,A: (2) K,R: (2)
0
0 0
1
1
1
E,S :(3) P,A,K,R: (4)
(7)
STEP 2.3
E:(2) S: (1) P,A: (2) K,R: (2)
0
0 0
1
1 1
P: (1) A: (1) K:(1) R :(1)
0
0
1
1
Symbol Count Code Number of
bits used
Probability
Pi
E 2 00 4 (2*2) 2/7 = 0.29
S 1 01 2 1/7 =0.14
P 1 100 3 1/7=0.14
A 1 101 3 1/7=0.14
K 1 110 3 1/7=0.14
R 1 111 3 1/7=0.14
Total number of bits : 18 bits
Compression Ratio
If the total number of bits required to represent the data before compression is B0
and the total number of bits required to represent the data after compression is B1
,
then we define the compression ratio as
Compression Ratio = B0
/ B1
B0
= 8 * 7 Symbols Assume each character symbol require 8 bit
B1
= 18 bits
Compression Ratio = 56/18 = 3.11 [ Positive Compression ]
Average number of bits used by 7 symbols in the above solution = 18 / 7 = 2.57
Entropy (η)
According to the Claude E. Shannon, the entropy η of an information source with
alphabet S = {S1
, S2
, ••. ,Sn
} is defined as:
η = H(S) =
where Pi
is the probability that symbol Si
in S will occur.
The term indicates the amount of information contained in Si
, which
corresponds to the number of bits needed to encode Si
.
= 0.29 * log2
(1/0.29) + [ 0.14 * log2
(1/0.14) ] * 5
= 0.29 * log2
(3.45) + [ 0.14 * log2
(7.14) ] * 5
= 0.29 * log2
(3.45) + [ 0.14 * log2
(7.14) ] * 5
= 0.29 * 1.79 + [ 0.14 * 2.84) ] * 5
= 0.52 + 0.40 * 5 = 0.52 + 2.00 = 2.52
This suggests that the minimum average number of bits to code each character in the
word SPEAKER would be at least 2.52. The Shannon-Fano algorithm delivers
satisfactory coding results for data compression.
Entropy (η)
References
● Fundamentals of Multimedia by Ze-Nian Li and Mark S Drew, Pearson Education, 2009
● Log calculator by https://ncalculators.com

More Related Content

What's hot

Channel capacity
Channel capacityChannel capacity
Channel capacity
PALLAB DAS
 
signal encoding techniques
signal encoding techniquessignal encoding techniques
signal encoding techniques
Srinivasa Rao
 
Pulse Code Modulation (PCM)
Pulse Code Modulation (PCM)Pulse Code Modulation (PCM)
Pulse Code Modulation (PCM)
Arun c
 
Lambda design rule
Lambda design ruleLambda design rule
Lambda design rule
Gowri Kishore
 
PULSE CODE MODULATION (PCM)
PULSE CODE MODULATION (PCM)PULSE CODE MODULATION (PCM)
PULSE CODE MODULATION (PCM)
vishnudharan11
 
Information Theory Coding 1
Information Theory Coding 1Information Theory Coding 1
Information Theory Coding 1
Mahafuz Aveek
 
BCH Codes
BCH CodesBCH Codes
BCH Codes
AakankshaR
 
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSComputer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Dr. SELVAGANESAN S
 
Pulse Modulation ppt
Pulse Modulation pptPulse Modulation ppt
Pulse Modulation ppt
sanjeev2419
 
Source coding theorem
Source coding theoremSource coding theorem
Source coding theorem
priyadharshini murugan
 
Mac protocols
Mac protocolsMac protocols
Mac protocols
juno susi
 
Analog-to Digital Conversion
Analog-to Digital ConversionAnalog-to Digital Conversion
Analog-to Digital Conversion
wajahat Gul
 
Digital Communication Unit 1
Digital Communication Unit 1Digital Communication Unit 1
Digital Communication Unit 1
Anjuman College of Engg. & Tech.
 
Convolutional Codes And Their Decoding
Convolutional Codes And Their DecodingConvolutional Codes And Their Decoding
Convolutional Codes And Their Decoding
Kakali Saharia
 
5. convolution and correlation of discrete time signals
5. convolution and correlation of discrete time signals 5. convolution and correlation of discrete time signals
5. convolution and correlation of discrete time signals
MdFazleRabbi18
 
Asynchronous transfer mode
Asynchronous transfer modeAsynchronous transfer mode
Asynchronous transfer mode
aniston0108
 
Hamming codes
Hamming codesHamming codes
Hamming codes
GIGI JOSEPH
 
M ary psk modulation
M ary psk modulationM ary psk modulation
M ary psk modulation
Ahmed Diaa
 

What's hot (20)

Channel capacity
Channel capacityChannel capacity
Channel capacity
 
signal encoding techniques
signal encoding techniquessignal encoding techniques
signal encoding techniques
 
Pulse Code Modulation (PCM)
Pulse Code Modulation (PCM)Pulse Code Modulation (PCM)
Pulse Code Modulation (PCM)
 
Lambda design rule
Lambda design ruleLambda design rule
Lambda design rule
 
Subband Coding
Subband CodingSubband Coding
Subband Coding
 
PULSE CODE MODULATION (PCM)
PULSE CODE MODULATION (PCM)PULSE CODE MODULATION (PCM)
PULSE CODE MODULATION (PCM)
 
Information Theory Coding 1
Information Theory Coding 1Information Theory Coding 1
Information Theory Coding 1
 
BCH Codes
BCH CodesBCH Codes
BCH Codes
 
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSComputer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
 
Pulse Modulation ppt
Pulse Modulation pptPulse Modulation ppt
Pulse Modulation ppt
 
ASk,FSK,PSK
ASk,FSK,PSKASk,FSK,PSK
ASk,FSK,PSK
 
Source coding theorem
Source coding theoremSource coding theorem
Source coding theorem
 
Mac protocols
Mac protocolsMac protocols
Mac protocols
 
Analog-to Digital Conversion
Analog-to Digital ConversionAnalog-to Digital Conversion
Analog-to Digital Conversion
 
Digital Communication Unit 1
Digital Communication Unit 1Digital Communication Unit 1
Digital Communication Unit 1
 
Convolutional Codes And Their Decoding
Convolutional Codes And Their DecodingConvolutional Codes And Their Decoding
Convolutional Codes And Their Decoding
 
5. convolution and correlation of discrete time signals
5. convolution and correlation of discrete time signals 5. convolution and correlation of discrete time signals
5. convolution and correlation of discrete time signals
 
Asynchronous transfer mode
Asynchronous transfer modeAsynchronous transfer mode
Asynchronous transfer mode
 
Hamming codes
Hamming codesHamming codes
Hamming codes
 
M ary psk modulation
M ary psk modulationM ary psk modulation
M ary psk modulation
 

Similar to Shannon-Fano algorithm

Information Theory and coding - Lecture 3
Information Theory and coding - Lecture 3Information Theory and coding - Lecture 3
Information Theory and coding - Lecture 3
Aref35
 
Lecture 2
Lecture 2Lecture 2
Lecture 2Muuluu
 
cp467_12_lecture14_image compression1.pdf
cp467_12_lecture14_image compression1.pdfcp467_12_lecture14_image compression1.pdf
cp467_12_lecture14_image compression1.pdf
shaikmoosa2003
 
Materi Program.ppt
Materi Program.pptMateri Program.ppt
Materi Program.ppt
FARIZMARIZANFIKRI202
 
Data Communication & Computer Networks : Data Types
Data Communication & Computer Networks : Data TypesData Communication & Computer Networks : Data Types
Data Communication & Computer Networks : Data Types
Dr Rajiv Srivastava
 
Information Theory MSU-EEE.ppt
Information Theory MSU-EEE.pptInformation Theory MSU-EEE.ppt
Information Theory MSU-EEE.ppt
robomango
 
Huffman&Shannon-multimedia algorithms.ppt
Huffman&Shannon-multimedia algorithms.pptHuffman&Shannon-multimedia algorithms.ppt
Huffman&Shannon-multimedia algorithms.ppt
PrincessSaro
 
Block Encryption Algorithm Project.docx
Block Encryption Algorithm Project.docxBlock Encryption Algorithm Project.docx
Block Encryption Algorithm Project.docx
UsamaAliLone3
 
Information Theory and coding - Lecture 2
Information Theory and coding - Lecture 2Information Theory and coding - Lecture 2
Information Theory and coding - Lecture 2
Aref35
 
Theory of Fundamental of IT(Information technology).pptx
Theory of Fundamental of IT(Information technology).pptxTheory of Fundamental of IT(Information technology).pptx
Theory of Fundamental of IT(Information technology).pptx
Lovely Singh
 
Komdat-Kompresi Data
Komdat-Kompresi DataKomdat-Kompresi Data
Komdat-Kompresi Data
mursalinfajri007
 
. computer codes
. computer codes. computer codes
. computer codes
asadsiddique12
 
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
venkatapranaykumarGa
 
Binary codes
Binary codesBinary codes
Binary codes
GargiKhanna1
 
Data representation
Data representationData representation
Data representation
Mysore
 
Unit 4 combinational circuit
Unit 4 combinational circuitUnit 4 combinational circuit
Unit 4 combinational circuit
Kalai Selvi
 

Similar to Shannon-Fano algorithm (20)

Information Theory and coding - Lecture 3
Information Theory and coding - Lecture 3Information Theory and coding - Lecture 3
Information Theory and coding - Lecture 3
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
cp467_12_lecture14_image compression1.pdf
cp467_12_lecture14_image compression1.pdfcp467_12_lecture14_image compression1.pdf
cp467_12_lecture14_image compression1.pdf
 
Materi Program.ppt
Materi Program.pptMateri Program.ppt
Materi Program.ppt
 
Data Communication & Computer Networks : Data Types
Data Communication & Computer Networks : Data TypesData Communication & Computer Networks : Data Types
Data Communication & Computer Networks : Data Types
 
Information Theory MSU-EEE.ppt
Information Theory MSU-EEE.pptInformation Theory MSU-EEE.ppt
Information Theory MSU-EEE.ppt
 
Arithmetic Coding
Arithmetic CodingArithmetic Coding
Arithmetic Coding
 
Huffman&Shannon-multimedia algorithms.ppt
Huffman&Shannon-multimedia algorithms.pptHuffman&Shannon-multimedia algorithms.ppt
Huffman&Shannon-multimedia algorithms.ppt
 
Block Encryption Algorithm Project.docx
Block Encryption Algorithm Project.docxBlock Encryption Algorithm Project.docx
Block Encryption Algorithm Project.docx
 
Compression ii
Compression iiCompression ii
Compression ii
 
W 9 numbering system
W 9 numbering systemW 9 numbering system
W 9 numbering system
 
W 9 numbering system
W 9 numbering systemW 9 numbering system
W 9 numbering system
 
Information Theory and coding - Lecture 2
Information Theory and coding - Lecture 2Information Theory and coding - Lecture 2
Information Theory and coding - Lecture 2
 
Theory of Fundamental of IT(Information technology).pptx
Theory of Fundamental of IT(Information technology).pptxTheory of Fundamental of IT(Information technology).pptx
Theory of Fundamental of IT(Information technology).pptx
 
Komdat-Kompresi Data
Komdat-Kompresi DataKomdat-Kompresi Data
Komdat-Kompresi Data
 
. computer codes
. computer codes. computer codes
. computer codes
 
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
 
Binary codes
Binary codesBinary codes
Binary codes
 
Data representation
Data representationData representation
Data representation
 
Unit 4 combinational circuit
Unit 4 combinational circuitUnit 4 combinational circuit
Unit 4 combinational circuit
 

More from MANISH T I

Budgerigar
BudgerigarBudgerigar
Budgerigar
MANISH T I
 
NAAC Criteria 3
NAAC  Criteria 3NAAC  Criteria 3
NAAC Criteria 3
MANISH T I
 
Artificial intelligence - An Overview
Artificial intelligence - An OverviewArtificial intelligence - An Overview
Artificial intelligence - An Overview
MANISH T I
 
The future of blogging
The future of bloggingThe future of blogging
The future of blogging
MANISH T I
 
Socrates - Most Important of his Thoughts
Socrates - Most Important of his ThoughtsSocrates - Most Important of his Thoughts
Socrates - Most Important of his Thoughts
MANISH T I
 
Technical writing
Technical writingTechnical writing
Technical writing
MANISH T I
 
Solar Image Processing
Solar Image Processing  Solar Image Processing
Solar Image Processing
MANISH T I
 
Graph Theory Introduction
Graph Theory IntroductionGraph Theory Introduction
Graph Theory Introduction
MANISH T I
 
Rooted & binary tree
Rooted & binary treeRooted & binary tree
Rooted & binary tree
MANISH T I
 
JPEG
JPEGJPEG
Colourful Living - Way of Life
Colourful Living - Way of LifeColourful Living - Way of Life
Colourful Living - Way of Life
MANISH T I
 
Introduction to Multimedia
Introduction to MultimediaIntroduction to Multimedia
Introduction to Multimedia
MANISH T I
 
Soft Computing
Soft ComputingSoft Computing
Soft Computing
MANISH T I
 
Research Methodology - Methods of data collection
 Research Methodology - Methods of data collection Research Methodology - Methods of data collection
Research Methodology - Methods of data collection
MANISH T I
 
15 lessons of lord buddha
15 lessons of lord buddha15 lessons of lord buddha
15 lessons of lord buddha
MANISH T I
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
MANISH T I
 
Research Methodology - Introduction
Research  Methodology - IntroductionResearch  Methodology - Introduction
Research Methodology - Introduction
MANISH T I
 
DBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORMDBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORM
MANISH T I
 
Simple Dictionary Compression
Simple Dictionary CompressionSimple Dictionary Compression
Simple Dictionary Compression
MANISH T I
 
Data Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length EncodingData Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length Encoding
MANISH T I
 

More from MANISH T I (20)

Budgerigar
BudgerigarBudgerigar
Budgerigar
 
NAAC Criteria 3
NAAC  Criteria 3NAAC  Criteria 3
NAAC Criteria 3
 
Artificial intelligence - An Overview
Artificial intelligence - An OverviewArtificial intelligence - An Overview
Artificial intelligence - An Overview
 
The future of blogging
The future of bloggingThe future of blogging
The future of blogging
 
Socrates - Most Important of his Thoughts
Socrates - Most Important of his ThoughtsSocrates - Most Important of his Thoughts
Socrates - Most Important of his Thoughts
 
Technical writing
Technical writingTechnical writing
Technical writing
 
Solar Image Processing
Solar Image Processing  Solar Image Processing
Solar Image Processing
 
Graph Theory Introduction
Graph Theory IntroductionGraph Theory Introduction
Graph Theory Introduction
 
Rooted & binary tree
Rooted & binary treeRooted & binary tree
Rooted & binary tree
 
JPEG
JPEGJPEG
JPEG
 
Colourful Living - Way of Life
Colourful Living - Way of LifeColourful Living - Way of Life
Colourful Living - Way of Life
 
Introduction to Multimedia
Introduction to MultimediaIntroduction to Multimedia
Introduction to Multimedia
 
Soft Computing
Soft ComputingSoft Computing
Soft Computing
 
Research Methodology - Methods of data collection
 Research Methodology - Methods of data collection Research Methodology - Methods of data collection
Research Methodology - Methods of data collection
 
15 lessons of lord buddha
15 lessons of lord buddha15 lessons of lord buddha
15 lessons of lord buddha
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Research Methodology - Introduction
Research  Methodology - IntroductionResearch  Methodology - Introduction
Research Methodology - Introduction
 
DBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORMDBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORM
 
Simple Dictionary Compression
Simple Dictionary CompressionSimple Dictionary Compression
Simple Dictionary Compression
 
Data Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length EncodingData Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length Encoding
 

Recently uploaded

The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 

Recently uploaded (20)

The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 

Shannon-Fano algorithm

  • 2. Introduction The Shannon-Fano algorithm was independently developed by Shannon at Bell Labs and Robert Fana at MIT. The encoding steps of the Shannon-Fano algorithm can be presented in the following top-down manner: 1. Sort the symbols according to the frequency count of their occurrences. 2. Recursively divide the symbols into two parts, each with approximately the same number of counts, until an parts contain only one symbol. A natural way of implementing the above procedure is to build a binary tree. As a convention, let's assign bit 0 to its left branches and 1 to the right branches.
  • 3. Example Symbols to be coded are the characters in the word SPEAKER. The frequency count of the symbols is Total number of symbols is 7 S 1 P 1 E 2 A 1 K 1 R 1
  • 4. E,S:(3) P,A,K,R:(4) (7)E 2 S 1 P 1 A 1 K 1 R 1 STEP 1 STEP 2.1 0 1 The first division yields two parts: (a) E,S with a total count of 3, denoted as E,S:(3); and (b) P,A,Kand R: with a total count of 4, denoted as P,A,K,R:(4).
  • 5. E,S: (3) P,A,K,R: (4) (7) STEP 2.2 E:(2) S: (1) P,A: (2) K,R: (2) 0 0 0 1 1 1
  • 6. E,S :(3) P,A,K,R: (4) (7) STEP 2.3 E:(2) S: (1) P,A: (2) K,R: (2) 0 0 0 1 1 1 P: (1) A: (1) K:(1) R :(1) 0 0 1 1
  • 7. Symbol Count Code Number of bits used Probability Pi E 2 00 4 (2*2) 2/7 = 0.29 S 1 01 2 1/7 =0.14 P 1 100 3 1/7=0.14 A 1 101 3 1/7=0.14 K 1 110 3 1/7=0.14 R 1 111 3 1/7=0.14 Total number of bits : 18 bits
  • 8. Compression Ratio If the total number of bits required to represent the data before compression is B0 and the total number of bits required to represent the data after compression is B1 , then we define the compression ratio as Compression Ratio = B0 / B1 B0 = 8 * 7 Symbols Assume each character symbol require 8 bit B1 = 18 bits Compression Ratio = 56/18 = 3.11 [ Positive Compression ] Average number of bits used by 7 symbols in the above solution = 18 / 7 = 2.57
  • 9. Entropy (η) According to the Claude E. Shannon, the entropy η of an information source with alphabet S = {S1 , S2 , ••. ,Sn } is defined as: η = H(S) = where Pi is the probability that symbol Si in S will occur. The term indicates the amount of information contained in Si , which corresponds to the number of bits needed to encode Si .
  • 10. = 0.29 * log2 (1/0.29) + [ 0.14 * log2 (1/0.14) ] * 5 = 0.29 * log2 (3.45) + [ 0.14 * log2 (7.14) ] * 5 = 0.29 * log2 (3.45) + [ 0.14 * log2 (7.14) ] * 5 = 0.29 * 1.79 + [ 0.14 * 2.84) ] * 5 = 0.52 + 0.40 * 5 = 0.52 + 2.00 = 2.52 This suggests that the minimum average number of bits to code each character in the word SPEAKER would be at least 2.52. The Shannon-Fano algorithm delivers satisfactory coding results for data compression. Entropy (η)
  • 11. References ● Fundamentals of Multimedia by Ze-Nian Li and Mark S Drew, Pearson Education, 2009 ● Log calculator by https://ncalculators.com