|
- String matching is a most important problem.
- String matching consists of searching a query string (or pattern) P in a given text T.
- Generally the size of the pattern to be searched is smaller than the given text.
- There may be more than one occurrences of the pattern P in the text T. Sometimes we have to find all the occurrences of the pattern in the text.
- There are several applications of the string matching. Some of these are
- Text editors
- Search engines
- Biological applications
- Since string-matching algorithms are used extensively, these should be efficient in terms of time and space.
- Let P [1..m] is the pattern to be searched and its size is m.
- T [1..n] is the given text whose size is n
- Assume that the pattern occurs in T at position (or shift) i. Then the output of the matching algorithm will be the integer i where 1 <= i <= n-m. If there are multiple occurrences of the pattern in the text, then sometimes it is required to output all the shifts where the pattern occurs.
|
|