String-searching algorithm
Definition
Let be a finite alphabet. Let and be strings over with ; is the pattern and is the text. The pattern occurs at position of , where , if for all . A string-searching algorithm is an algorithm that, given and , outputs the set of all positions at which occurs in .
Remarks
Example: the naive algorithm checks, for each , the equalities in turn. It outputs exactly the positions of occurrence, so it is a string-searching algorithm, and it uses comparisons. For and it outputs .
Non-example: a procedure that stops and outputs the first position of an occurrence solves only the weaker problem of finding one occurrence, not all of them.
Many variants exist: searching for several patterns at once, as in the Aho–Corasick algorithm, or allowing a bounded number of mismatches.
Reading path
To understand this page from the ground up, read these 4 pages in order. The foundations come first.
Show the path as a graph
- no evidence level
- Algorithm concept
- Alphabet concept
- String concept
- String-searching algorithm definition
Further reading
About this page
| Tag | R75EQC05SX |
|---|---|
| URI | m2://R75EQC05SX |
| Kind | definition |
| Writing | W0 stub |
| MSC | 68W32, 68R15, 68W40 |
| Defines | String-searching algorithm |
| Uses | Alphabet, String, Algorithm |
| Changed | 3 November 2026 |
Markdown · JSON · Edit on GitHub
What this page needs for W1
- an inventory row: the row of the inventory that the node accounts for (0 of 1)
- a source with a locator (0 of 1)
The writing levels say how complete the text of a page is. They do not measure its truth.
What links here
No page links to this page yet.