SlideShare a Scribd company logo
1 of 27
Download to read offline
Introduction to Data communication
Topic : LZ Algorithms
Lecture #14
Dr Rajiv Srivastava
Director
Sagar Institute of Research & Technology (SIRT)
Sagar Group of Institutions, Bhopal
http://www.sirtbhopal.ac.in
Unit 1
Lecture 14
2
Lampel ZIV (LZ) code
 The Lempel-Ziv algorithm is a variable-to-fixed length
code
 Basically, there are two versions of the algorithm
 LZ77 and LZ78 are the two lossless data compression
algorithms published by Abraham Lempel and Jacob Ziv
in 1977 & 1978. They are also known as LZ1 and LZ2
respectively.
 These two algorithms form the basis for many variations
including LZW, LZSS, LZMA and others. Besides their
academic influence, these algorithms formed the basis of
several ubiquitous compression schemes, including GIF
and the DEFLATE algorithm used in PNG.
 They are both theoretically dictionary coders.
 LZ77 keeps track of last n-bytes seen of data & when a
phrase is encountered that already has been seen, it outputs
a pair of values corresponding to the position of pharase in
previously seen buffer data & it moves a fixed size window
over data. It does so by maintaining a sliding window
during compression. This was later shown to be equivalent
to the explicit dictionary constructed by LZ78—however,
they are only equivalent when the entire data is intended to
be decompressed.
 LZ78 decompression allows random access to the input as
long as the entire dictionary is available, while LZ77
decompression must always start at the beginning of the
input.
 If we compare it Huffman code then we find the major
disadvantage of the Huffman code is that the symbol
probabilities must be known or estimated if they are
unknown.
 In addition to this, the encoder and Decoder must know
the coding tree.
 Moreover in the modeling text, the storage requirement
prevent the Huffman code from capturing the higher
order relationship between words and phrases.
• So we have to compromise the efficiency of
code.
• These practical limitation of Huffman code
can be overcome by using the lampel ZIV
algorithm.
• It is adaptive and simpler to implement as
compared to Huffman coding.
• Principal of Lampel ZIV algorithm
• To illustrate this principle let us consider the
example of an input binary sequence specified
as :
000101110010
The encoding in this algorithm is accomplished by parsing
the source data stream into segments that are the shortest
substances not encountered previously.
• We assume that the binary symbols 0 and 1 are
already stored in this order in the code book.
Hence we write,
subsequences stored : 0, 1
Data to be parsed : 000101110010
• Now examine the data in above equation from
LHS and find the shortest subsequence which is
not encountered previously. It is 00. so we
include 00 as the next entry in the subsequence
and move00 from data to subsequence as follow :
Subsequences stored : 0, 1, 00
Data to be parsed : 010110010
• The next shortest Subsequences which is not
previously repeated is 01. In above equation
Note that we are examining from LHS. Hence
we write,
Subsequences stored : 0, 1, 00, 01
Data to be parsed : 01110010
• The next shortest Subsequences which is
previously not encountered is 011. so we
write,
Subsequences stored : 0, 1, 00, 01,011
Data to be parsed : 10010
• Similarly we can continue until the data
stream has been completely parsed. The code
book of binary Subsequences gets ready as
shown in figure
Code book of Sequence
• The first row in the codebook shows the
numerical position of various subsequence in
the codebook.
Numerical
Position
1 2 3 4 5 6 7
Subsequences 0 1 00 01 001 10 010
• Numerical representation :
• Let us now add third row to figure. This row is
called as numerical representation as shown
in figure
Numerical
Position
1 2 3 4 5 6 7
Subsequences 0 1 00 01 011 10 010
Numerical
representation
11 12 42 21 41
The sequences 0 and 1 are originally stored. So
consider the third Subsequences i.e. 00. this is the
first Subsequences in the data stream and it is
made up of concatenation of the first
Subsequences i.e. 0 with itself.
Hence it is represented by 11 in the row of
numerical representation in above figure
Similarly, subsequences 01 obtained by
concatenation of first and second subsequences so
we enter 12 below that.
The remaining subsequences are treated
accordingly.
• Binary Encoded Representation :
• The last (4th ) row added as shown in figure, is
the binary encoded representation of each
subsequence.
Numerical
Position
1 2 3 4 5 6 7
Subsequences 0 1 00 01 011 10 010
Numerical
representation
11 12 42 21 41
Binary encoded
blocks
0010 0011 1001 0100 1000
• The question is how to obtain binary encoded
blocks.
• the last symbol of each subsequence in the
second row of above figure (called as
codebook) is called as an innovation symbol.
• So the last bit in each binary encoded block
(4th row) is the innovation symbol of the
corresponding subsequence,
The remaining bits provide the equivalent
i a y ep ese tatio of the poi te to the
oot su se ue e that at hes the o e i
question except for the innovation symbol.
This can be explained as follow.
1. Consider Numerical position 3 in figure. The
binary encoded block is 0010.
2. Consider Numerical position 5 in figure. It is
partially reproduced below.
• Row 1: Numerical position 3
• Row 2: Subsequence
• Row 4: Binary encoded Block
0 0
Innovation
number
001 0
This is the first
subsequence
Take as it is
Binary equivalent of
1(this is called pointer)
• Row 1: Numerical position 5
• Row 2: Subsequence
• Row 4: Binary encoded Block
01 1
Innovation
number
This is the 4th
subsequence
100 1
Binary equivalent of 4.
(this is called pointer)
Take as it is
 Consider the numerical position 6 in figure.
It is partially reproduced below.
 Row 1: Numerical position 6
 Row 2: Subsequence
 Row 4: Binary encoded Block
 Similarly the other entries in the fourth row are made.
1 0
Innovation
number
This is the 2nd
subsequence
010 0
Take as it is
Binary equivalent of 2.
(this is called pointer)
• Decoder
• The decoding is as simple encoding. The steps
followed at the time of decoding are as follows :
• Step 1 : Take the binary encoded block.
For example consider the binary encoded block in
position 5 i.e. 1001
• Step 2 : use the pointer to identify the root
subsequence :
• Binary encoded block
• Append the innovation symbol to the subsequence in
step 2:
Append the innovation number i.e. 1 to the root
subsequence of 01 to get the subsequence 011
corresponding to position 5.
100 1
Innovation
numberPointer = 4
Pointer value 4 corresponds
to 4th subsequence i.e. 01
Example: Determine the Lempel ZIV code for the following bit
steram
01001111100101000001010101100110000
Recover the original sequence from the encoded stream
• Soln.
• Part 1 : Encoding
• We assume that the binary symbols 0 and1 are
already stored in the code book.
Subsequences stored : 0, 1
• Encoding is accomplished by parsing the
source data stream into segment that are
shortest substances, not encountered
previously.
• The given stream of bits can be parsed into
subsequence as shown below :
0, 1, 00, 11, 111, 001, 01, 000, 0010, 10, 101,
100, 110, 000
• The encoding table is as shown in table
Part II Decoding
Consider the code for example
Numerical Position 1 2 3 4 5 6 7 8 9 10 11 12
Subsequences 0 1 00 11 111 001 01 000 0010 10 101 100
Numerical
representation
- - 11 22 42 32 12 31 61 21 102 100
code 0 1 0010 0101 1001 0111 0011 0110 1100 010
0
1010
1
1010
0
• Corre
• Ss
corresponding subsequence is 00
• The decoding table is shown in table
001 0
Innovation number
(do not change)
Pointer = 1
This value corresponds to 1st
subsequence is 0
• Decoding table.
• Thus we get the original sequence back
Code 0010 0101 1001 0111 0011 0110 1100 0100 10101 10100
Innovation bit 0 1 1 1 1 0 0 0 1 0
Pointer 001 010 100 011 001 011 110 010 1010 1010
Decoded
subsequence
0 0 1 1 1 1 1 0 0 1 0 1 0 0 0 0 010 1 0 1 0 1 1 0 0
Thank You
Dr Rajiv Srivastava
Director
Sagar Institute of Research & Technology (SIRT)
Sagar Group of Institutions, Bhopal
http://www.sirtbhopal.ac.in

More Related Content

What's hot

8279 in microprocessor
8279 in microprocessor8279 in microprocessor
8279 in microprocessorAisu
 
Weighted and Non Weighted Codes
Weighted and Non Weighted CodesWeighted and Non Weighted Codes
Weighted and Non Weighted CodesSubhamSatpathy2
 
Lz77 (sliding window)
Lz77 (sliding window)Lz77 (sliding window)
Lz77 (sliding window)MANISH T I
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086saurav kumar
 
Lecture 4 Relationship between pixels
Lecture 4 Relationship between pixelsLecture 4 Relationship between pixels
Lecture 4 Relationship between pixelsVARUN KUMAR
 
Assembly language 8086
Assembly language 8086Assembly language 8086
Assembly language 8086John Cutajar
 
Logical and shift micro operations
Logical and shift micro operationsLogical and shift micro operations
Logical and shift micro operationsSanjeev Patel
 
4.programmable dma controller 8257
4.programmable dma controller 82574.programmable dma controller 8257
4.programmable dma controller 8257MdFazleRabbi18
 
Lecture 2
Lecture 2Lecture 2
Lecture 2GIKI
 
Arithmetic coding
Arithmetic codingArithmetic coding
Arithmetic codingVikas Goyal
 
Manchester & Differential Manchester encoding scheme
Manchester & Differential Manchester encoding schemeManchester & Differential Manchester encoding scheme
Manchester & Differential Manchester encoding schemeArunabha Saha
 
Floating point arithmetic operations (1)
Floating point arithmetic operations (1)Floating point arithmetic operations (1)
Floating point arithmetic operations (1)cs19club
 

What's hot (20)

8279 in microprocessor
8279 in microprocessor8279 in microprocessor
8279 in microprocessor
 
Lzw
LzwLzw
Lzw
 
branch ins 8051
branch ins 8051branch ins 8051
branch ins 8051
 
Weighted and Non Weighted Codes
Weighted and Non Weighted CodesWeighted and Non Weighted Codes
Weighted and Non Weighted Codes
 
Lz77 (sliding window)
Lz77 (sliding window)Lz77 (sliding window)
Lz77 (sliding window)
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Lecture 4 Relationship between pixels
Lecture 4 Relationship between pixelsLecture 4 Relationship between pixels
Lecture 4 Relationship between pixels
 
Image segmentation
Image segmentation Image segmentation
Image segmentation
 
Assembly language 8086
Assembly language 8086Assembly language 8086
Assembly language 8086
 
Unit 3 Arithmetic Coding
Unit 3 Arithmetic CodingUnit 3 Arithmetic Coding
Unit 3 Arithmetic Coding
 
Unit ii
Unit iiUnit ii
Unit ii
 
Logical and shift micro operations
Logical and shift micro operationsLogical and shift micro operations
Logical and shift micro operations
 
4.programmable dma controller 8257
4.programmable dma controller 82574.programmable dma controller 8257
4.programmable dma controller 8257
 
Linear block code
Linear block codeLinear block code
Linear block code
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
program status word
program status wordprogram status word
program status word
 
Arithmetic coding
Arithmetic codingArithmetic coding
Arithmetic coding
 
Manchester & Differential Manchester encoding scheme
Manchester & Differential Manchester encoding schemeManchester & Differential Manchester encoding scheme
Manchester & Differential Manchester encoding scheme
 
Floating point arithmetic operations (1)
Floating point arithmetic operations (1)Floating point arithmetic operations (1)
Floating point arithmetic operations (1)
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 

Similar to Data Communication & Computer Networks : LZ algorithms

Physics investigatory project for class 12 logic gates
Physics investigatory project for class 12 logic gatesPhysics investigatory project for class 12 logic gates
Physics investigatory project for class 12 logic gatesbiswanath dehuri
 
Dee 2034 chapter 1 number and code system (Baia)
Dee 2034 chapter 1 number and code system (Baia)Dee 2034 chapter 1 number and code system (Baia)
Dee 2034 chapter 1 number and code system (Baia)SITI SABARIAH SALIHIN
 
Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:Asif Iqbal
 
dtei-180910104911-converted.pptx
dtei-180910104911-converted.pptxdtei-180910104911-converted.pptx
dtei-180910104911-converted.pptxdeepaMS4
 
Digital fundamendals r001a
Digital fundamendals r001aDigital fundamendals r001a
Digital fundamendals r001aarunachalamr16
 
COMPUTER ORGANIZATION NOTES Unit 2
COMPUTER ORGANIZATION NOTES  Unit 2COMPUTER ORGANIZATION NOTES  Unit 2
COMPUTER ORGANIZATION NOTES Unit 2Dr.MAYA NAYAK
 
Implementation and Simulation of Ieee 754 Single-Precision Floating Point Mul...
Implementation and Simulation of Ieee 754 Single-Precision Floating Point Mul...Implementation and Simulation of Ieee 754 Single-Precision Floating Point Mul...
Implementation and Simulation of Ieee 754 Single-Precision Floating Point Mul...inventionjournals
 
digital-electronics lecture Ch 1and 2 -1.pptx
digital-electronics lecture Ch 1and 2 -1.pptxdigital-electronics lecture Ch 1and 2 -1.pptx
digital-electronics lecture Ch 1and 2 -1.pptxabelllll
 
EC Binary Substraction using 1's Complement,2's Complement
EC Binary Substraction using 1's Complement,2's ComplementEC Binary Substraction using 1's Complement,2's Complement
EC Binary Substraction using 1's Complement,2's ComplementAmberSinghal1
 
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...Arti Parab Academics
 
data representation
 data representation data representation
data representationHaroon_007
 
Chapter 1 number and code system sss
Chapter 1 number and code system sssChapter 1 number and code system sss
Chapter 1 number and code system sssBaia Salihin
 

Similar to Data Communication & Computer Networks : LZ algorithms (20)

Lz algorithm
Lz algorithmLz algorithm
Lz algorithm
 
Physics investigatory project for class 12 logic gates
Physics investigatory project for class 12 logic gatesPhysics investigatory project for class 12 logic gates
Physics investigatory project for class 12 logic gates
 
Dee 2034 chapter 1 number and code system (Baia)
Dee 2034 chapter 1 number and code system (Baia)Dee 2034 chapter 1 number and code system (Baia)
Dee 2034 chapter 1 number and code system (Baia)
 
Number Systems.ppt
Number Systems.pptNumber Systems.ppt
Number Systems.ppt
 
Digital Logic
Digital LogicDigital Logic
Digital Logic
 
Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:
 
Representation Of Numbers and Characters
Representation Of Numbers and CharactersRepresentation Of Numbers and Characters
Representation Of Numbers and Characters
 
dtei-180910104911-converted.pptx
dtei-180910104911-converted.pptxdtei-180910104911-converted.pptx
dtei-180910104911-converted.pptx
 
Dpsd lecture-notes
Dpsd lecture-notesDpsd lecture-notes
Dpsd lecture-notes
 
Digital fundamendals r001a
Digital fundamendals r001aDigital fundamendals r001a
Digital fundamendals r001a
 
COMPUTER ORGANIZATION NOTES Unit 2
COMPUTER ORGANIZATION NOTES  Unit 2COMPUTER ORGANIZATION NOTES  Unit 2
COMPUTER ORGANIZATION NOTES Unit 2
 
Implementation and Simulation of Ieee 754 Single-Precision Floating Point Mul...
Implementation and Simulation of Ieee 754 Single-Precision Floating Point Mul...Implementation and Simulation of Ieee 754 Single-Precision Floating Point Mul...
Implementation and Simulation of Ieee 754 Single-Precision Floating Point Mul...
 
digital-electronics lecture Ch 1and 2 -1.pptx
digital-electronics lecture Ch 1and 2 -1.pptxdigital-electronics lecture Ch 1and 2 -1.pptx
digital-electronics lecture Ch 1and 2 -1.pptx
 
DCF QNA edited
DCF QNA editedDCF QNA edited
DCF QNA edited
 
EC Binary Substraction using 1's Complement,2's Complement
EC Binary Substraction using 1's Complement,2's ComplementEC Binary Substraction using 1's Complement,2's Complement
EC Binary Substraction using 1's Complement,2's Complement
 
Number codes students
Number codes studentsNumber codes students
Number codes students
 
Alu1
Alu1Alu1
Alu1
 
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
 
data representation
 data representation data representation
data representation
 
Chapter 1 number and code system sss
Chapter 1 number and code system sssChapter 1 number and code system sss
Chapter 1 number and code system sss
 

More from Dr Rajiv Srivastava

Placement at sagar group Bhopal | SIRT College Bhopal
Placement at sagar group Bhopal  | SIRT College Bhopal Placement at sagar group Bhopal  | SIRT College Bhopal
Placement at sagar group Bhopal | SIRT College Bhopal Dr Rajiv Srivastava
 
How to Prepare for Group Discussion
How to Prepare for Group DiscussionHow to Prepare for Group Discussion
How to Prepare for Group DiscussionDr Rajiv Srivastava
 
SAGE GROUP - BEST ENGINEERING COLLEGE IN BHOPAL MP
SAGE GROUP - BEST ENGINEERING COLLEGE IN BHOPAL MP SAGE GROUP - BEST ENGINEERING COLLEGE IN BHOPAL MP
SAGE GROUP - BEST ENGINEERING COLLEGE IN BHOPAL MP Dr Rajiv Srivastava
 
Topic : X.25, Frame relay and ATM
Topic :  X.25, Frame relay and ATMTopic :  X.25, Frame relay and ATM
Topic : X.25, Frame relay and ATMDr Rajiv Srivastava
 
Topic : ISDN(integrated services digital network) part 2
Topic : ISDN(integrated services digital network) part 2Topic : ISDN(integrated services digital network) part 2
Topic : ISDN(integrated services digital network) part 2Dr Rajiv Srivastava
 
Topic: ISDN (Integrated Services Digital Network)
Topic: ISDN (Integrated Services Digital Network)Topic: ISDN (Integrated Services Digital Network)
Topic: ISDN (Integrated Services Digital Network)Dr Rajiv Srivastava
 
Topic: Virtual circuit & message switching
Topic: Virtual circuit & message switchingTopic: Virtual circuit & message switching
Topic: Virtual circuit & message switchingDr Rajiv Srivastava
 
Introduction to switching & circuit switching
Introduction to switching & circuit switchingIntroduction to switching & circuit switching
Introduction to switching & circuit switchingDr Rajiv Srivastava
 
Topic:Terminal handling & polling
Topic:Terminal handling & pollingTopic:Terminal handling & polling
Topic:Terminal handling & pollingDr Rajiv Srivastava
 
Applications of Time Division multiplexing : statistical TDM
Applications of  Time Division multiplexing : statistical TDMApplications of  Time Division multiplexing : statistical TDM
Applications of Time Division multiplexing : statistical TDMDr Rajiv Srivastava
 
Multiplexing : Wave Division Multiplexing
Multiplexing : Wave Division MultiplexingMultiplexing : Wave Division Multiplexing
Multiplexing : Wave Division MultiplexingDr Rajiv Srivastava
 
Data Communication & Computer network: Shanon fano coding
Data Communication & Computer network: Shanon fano codingData Communication & Computer network: Shanon fano coding
Data Communication & Computer network: Shanon fano codingDr Rajiv Srivastava
 
Data Communication & Computer Networks : LZW compression method
Data Communication & Computer Networks : LZW compression methodData Communication & Computer Networks : LZW compression method
Data Communication & Computer Networks : LZW compression methodDr Rajiv Srivastava
 

More from Dr Rajiv Srivastava (20)

Trends of it
Trends of itTrends of it
Trends of it
 
Placement at sagar group Bhopal | SIRT College Bhopal
Placement at sagar group Bhopal  | SIRT College Bhopal Placement at sagar group Bhopal  | SIRT College Bhopal
Placement at sagar group Bhopal | SIRT College Bhopal
 
How to Prepare for Group Discussion
How to Prepare for Group DiscussionHow to Prepare for Group Discussion
How to Prepare for Group Discussion
 
Unix ppt
Unix pptUnix ppt
Unix ppt
 
SAGE GROUP - BEST ENGINEERING COLLEGE IN BHOPAL MP
SAGE GROUP - BEST ENGINEERING COLLEGE IN BHOPAL MP SAGE GROUP - BEST ENGINEERING COLLEGE IN BHOPAL MP
SAGE GROUP - BEST ENGINEERING COLLEGE IN BHOPAL MP
 
lecture on data compression
lecture on data compressionlecture on data compression
lecture on data compression
 
Topic : X.25, Frame relay and ATM
Topic :  X.25, Frame relay and ATMTopic :  X.25, Frame relay and ATM
Topic : X.25, Frame relay and ATM
 
Topic : B ISDN
Topic : B ISDNTopic : B ISDN
Topic : B ISDN
 
Topic : ISDN(integrated services digital network) part 2
Topic : ISDN(integrated services digital network) part 2Topic : ISDN(integrated services digital network) part 2
Topic : ISDN(integrated services digital network) part 2
 
Topic: ISDN (Integrated Services Digital Network)
Topic: ISDN (Integrated Services Digital Network)Topic: ISDN (Integrated Services Digital Network)
Topic: ISDN (Integrated Services Digital Network)
 
Topic: Virtual circuit & message switching
Topic: Virtual circuit & message switchingTopic: Virtual circuit & message switching
Topic: Virtual circuit & message switching
 
Topic Packet switching
Topic Packet switchingTopic Packet switching
Topic Packet switching
 
Introduction to switching & circuit switching
Introduction to switching & circuit switchingIntroduction to switching & circuit switching
Introduction to switching & circuit switching
 
Topic:Terminal handling & polling
Topic:Terminal handling & pollingTopic:Terminal handling & polling
Topic:Terminal handling & polling
 
Topic: Spread Spectrum
Topic: Spread SpectrumTopic: Spread Spectrum
Topic: Spread Spectrum
 
Applications of Time Division multiplexing : statistical TDM
Applications of  Time Division multiplexing : statistical TDMApplications of  Time Division multiplexing : statistical TDM
Applications of Time Division multiplexing : statistical TDM
 
Multiplexing : Wave Division Multiplexing
Multiplexing : Wave Division MultiplexingMultiplexing : Wave Division Multiplexing
Multiplexing : Wave Division Multiplexing
 
Multiplexing : FDM
Multiplexing : FDMMultiplexing : FDM
Multiplexing : FDM
 
Data Communication & Computer network: Shanon fano coding
Data Communication & Computer network: Shanon fano codingData Communication & Computer network: Shanon fano coding
Data Communication & Computer network: Shanon fano coding
 
Data Communication & Computer Networks : LZW compression method
Data Communication & Computer Networks : LZW compression methodData Communication & Computer Networks : LZW compression method
Data Communication & Computer Networks : LZW compression method
 

Recently uploaded

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 

Recently uploaded (20)

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 

Data Communication & Computer Networks : LZ algorithms

  • 1. Introduction to Data communication Topic : LZ Algorithms Lecture #14 Dr Rajiv Srivastava Director Sagar Institute of Research & Technology (SIRT) Sagar Group of Institutions, Bhopal http://www.sirtbhopal.ac.in
  • 3. Lampel ZIV (LZ) code  The Lempel-Ziv algorithm is a variable-to-fixed length code  Basically, there are two versions of the algorithm  LZ77 and LZ78 are the two lossless data compression algorithms published by Abraham Lempel and Jacob Ziv in 1977 & 1978. They are also known as LZ1 and LZ2 respectively.  These two algorithms form the basis for many variations including LZW, LZSS, LZMA and others. Besides their academic influence, these algorithms formed the basis of several ubiquitous compression schemes, including GIF and the DEFLATE algorithm used in PNG.
  • 4.  They are both theoretically dictionary coders.  LZ77 keeps track of last n-bytes seen of data & when a phrase is encountered that already has been seen, it outputs a pair of values corresponding to the position of pharase in previously seen buffer data & it moves a fixed size window over data. It does so by maintaining a sliding window during compression. This was later shown to be equivalent to the explicit dictionary constructed by LZ78—however, they are only equivalent when the entire data is intended to be decompressed.  LZ78 decompression allows random access to the input as long as the entire dictionary is available, while LZ77 decompression must always start at the beginning of the input.
  • 5.  If we compare it Huffman code then we find the major disadvantage of the Huffman code is that the symbol probabilities must be known or estimated if they are unknown.  In addition to this, the encoder and Decoder must know the coding tree.  Moreover in the modeling text, the storage requirement prevent the Huffman code from capturing the higher order relationship between words and phrases.
  • 6. • So we have to compromise the efficiency of code. • These practical limitation of Huffman code can be overcome by using the lampel ZIV algorithm. • It is adaptive and simpler to implement as compared to Huffman coding.
  • 7. • Principal of Lampel ZIV algorithm • To illustrate this principle let us consider the example of an input binary sequence specified as : 000101110010 The encoding in this algorithm is accomplished by parsing the source data stream into segments that are the shortest substances not encountered previously.
  • 8. • We assume that the binary symbols 0 and 1 are already stored in this order in the code book. Hence we write, subsequences stored : 0, 1 Data to be parsed : 000101110010 • Now examine the data in above equation from LHS and find the shortest subsequence which is not encountered previously. It is 00. so we include 00 as the next entry in the subsequence and move00 from data to subsequence as follow :
  • 9. Subsequences stored : 0, 1, 00 Data to be parsed : 010110010 • The next shortest Subsequences which is not previously repeated is 01. In above equation Note that we are examining from LHS. Hence we write, Subsequences stored : 0, 1, 00, 01 Data to be parsed : 01110010
  • 10. • The next shortest Subsequences which is previously not encountered is 011. so we write, Subsequences stored : 0, 1, 00, 01,011 Data to be parsed : 10010 • Similarly we can continue until the data stream has been completely parsed. The code book of binary Subsequences gets ready as shown in figure
  • 11. Code book of Sequence • The first row in the codebook shows the numerical position of various subsequence in the codebook. Numerical Position 1 2 3 4 5 6 7 Subsequences 0 1 00 01 001 10 010
  • 12. • Numerical representation : • Let us now add third row to figure. This row is called as numerical representation as shown in figure Numerical Position 1 2 3 4 5 6 7 Subsequences 0 1 00 01 011 10 010 Numerical representation 11 12 42 21 41
  • 13. The sequences 0 and 1 are originally stored. So consider the third Subsequences i.e. 00. this is the first Subsequences in the data stream and it is made up of concatenation of the first Subsequences i.e. 0 with itself. Hence it is represented by 11 in the row of numerical representation in above figure Similarly, subsequences 01 obtained by concatenation of first and second subsequences so we enter 12 below that. The remaining subsequences are treated accordingly.
  • 14. • Binary Encoded Representation : • The last (4th ) row added as shown in figure, is the binary encoded representation of each subsequence. Numerical Position 1 2 3 4 5 6 7 Subsequences 0 1 00 01 011 10 010 Numerical representation 11 12 42 21 41 Binary encoded blocks 0010 0011 1001 0100 1000
  • 15. • The question is how to obtain binary encoded blocks. • the last symbol of each subsequence in the second row of above figure (called as codebook) is called as an innovation symbol. • So the last bit in each binary encoded block (4th row) is the innovation symbol of the corresponding subsequence,
  • 16. The remaining bits provide the equivalent i a y ep ese tatio of the poi te to the oot su se ue e that at hes the o e i question except for the innovation symbol. This can be explained as follow. 1. Consider Numerical position 3 in figure. The binary encoded block is 0010. 2. Consider Numerical position 5 in figure. It is partially reproduced below.
  • 17. • Row 1: Numerical position 3 • Row 2: Subsequence • Row 4: Binary encoded Block 0 0 Innovation number 001 0 This is the first subsequence Take as it is Binary equivalent of 1(this is called pointer)
  • 18. • Row 1: Numerical position 5 • Row 2: Subsequence • Row 4: Binary encoded Block 01 1 Innovation number This is the 4th subsequence 100 1 Binary equivalent of 4. (this is called pointer) Take as it is
  • 19.  Consider the numerical position 6 in figure. It is partially reproduced below.  Row 1: Numerical position 6  Row 2: Subsequence  Row 4: Binary encoded Block  Similarly the other entries in the fourth row are made. 1 0 Innovation number This is the 2nd subsequence 010 0 Take as it is Binary equivalent of 2. (this is called pointer)
  • 20. • Decoder • The decoding is as simple encoding. The steps followed at the time of decoding are as follows : • Step 1 : Take the binary encoded block. For example consider the binary encoded block in position 5 i.e. 1001 • Step 2 : use the pointer to identify the root subsequence :
  • 21. • Binary encoded block • Append the innovation symbol to the subsequence in step 2: Append the innovation number i.e. 1 to the root subsequence of 01 to get the subsequence 011 corresponding to position 5. 100 1 Innovation numberPointer = 4 Pointer value 4 corresponds to 4th subsequence i.e. 01
  • 22. Example: Determine the Lempel ZIV code for the following bit steram 01001111100101000001010101100110000 Recover the original sequence from the encoded stream • Soln. • Part 1 : Encoding • We assume that the binary symbols 0 and1 are already stored in the code book. Subsequences stored : 0, 1
  • 23. • Encoding is accomplished by parsing the source data stream into segment that are shortest substances, not encountered previously. • The given stream of bits can be parsed into subsequence as shown below : 0, 1, 00, 11, 111, 001, 01, 000, 0010, 10, 101, 100, 110, 000 • The encoding table is as shown in table
  • 24. Part II Decoding Consider the code for example Numerical Position 1 2 3 4 5 6 7 8 9 10 11 12 Subsequences 0 1 00 11 111 001 01 000 0010 10 101 100 Numerical representation - - 11 22 42 32 12 31 61 21 102 100 code 0 1 0010 0101 1001 0111 0011 0110 1100 010 0 1010 1 1010 0
  • 25. • Corre • Ss corresponding subsequence is 00 • The decoding table is shown in table 001 0 Innovation number (do not change) Pointer = 1 This value corresponds to 1st subsequence is 0
  • 26. • Decoding table. • Thus we get the original sequence back Code 0010 0101 1001 0111 0011 0110 1100 0100 10101 10100 Innovation bit 0 1 1 1 1 0 0 0 1 0 Pointer 001 010 100 011 001 011 110 010 1010 1010 Decoded subsequence 0 0 1 1 1 1 1 0 0 1 0 1 0 0 0 0 010 1 0 1 0 1 1 0 0
  • 27. Thank You Dr Rajiv Srivastava Director Sagar Institute of Research & Technology (SIRT) Sagar Group of Institutions, Bhopal http://www.sirtbhopal.ac.in