18 String Matching - KMP Algorithm
18 String Matching - KMP Algorithm
Dr. D. P. Acharjya
Professor, SCOPE
SJT Annex – 201 E
2/28/2024 Dr. D. P. Acharjya 1
String Matching Problem
Finding all occurrences of a pattern (String) in a text
leads to string matching problem.
It arises frequently in text editing programs where text
is a document, and the string searched for is a
particular word.
String-matching algorithms are also used to search for
particular patterns in DNA sequences.
For Example:
q=0
For i = 1 to 15