Initialize Table With Single Character Strings P First Input Character
Initialize Table With Single Character Strings P First Input Character
Initialize Table With Single Character Strings P First Input Character
This algorithm was developed by Abraham lampel and Jacob Zev in 19777.Lampel Ziv algorithm is a
decompression algorithm that is type of loseless algorithm. The data is fully conserved in the
implementation of the data. It not only maintains data but also reduces memory occupation of data.
It reduces redundancy in data hence less memory is required to keep data. It has vast application. In
the initial formation of algorithm, no implementation was explained so it has different variants in
market like LZ77 and LZ78.
Explanation:
The basis of its working is similar to Run-Length algorithm i-e: Repetition of worlds or set of words.
The algorithm actually takes up the input and then breaks it on the basis of repetition of data. Then
it encodes each phrase. The encoded data has following things:
Code of phrase
Location of prefix
Value of last bit
The parsed string is stored in the form of table that has phrases and their codes in it. In this way,
there is no iteration of data and input is converted in form of dictionary of most used words.
Functionality:
Pseudo Code:
IF P + C is in the
string table
P=P+C
ELSE
output the code for P
add P + C to the
string
table P =
C
END WHILE
Graphical Representation:
Let us consider an example:
wabbawabba
We will make dictionary of all possible unique sub strings.
f k c c k f k c c k
Index : 1
Substring : f
f k c c k f k c c k
Index : 2
Substring : k
f k c c k f k c c k
Index : 3
Substring : c
f k c c k f k c c k
Index : 4
Substring : fk
f k c c k f k c c k
Index : 5
Substring : kc
f k c c k f k c c k
Index : 6
Substring : cc
f k c c k f k c c k
Index : 7
Substring : ck
f k c c k f k c c k
Index : 8
Substring : kf
f k c c k f k c c k
Index : 9
Substring : fkc
f k c c k f k c c k
Index : 10
Substring : cck
Final Code: