Functions implementing various search algorithms.
More...
|
| int | search_naive (char *text, const char *pattern) |
| | Finds the first occurrence of a pattern in a text using the naive string searching algorithm.
|
| int | search_kmp (char *text, const char *pattern) |
| | Finds the first occurrence of a pattern in a text using the Knuth-Morris-Pratt (KMP) algorithm.
|
| int | search_bm (char *text, const char *pattern) |
| | Finds the first occurrence of a pattern in a text using the Boyer-Moore string searching algorithm.
|
| int | search_kr (char *text, const char *pattern) |
| | Finds the first occurrence of a pattern in a text using the Karp-Rabin algorithm.
|
Functions implementing various search algorithms.
◆ search_bm()
| int search_bm |
( |
char * | text, |
|
|
const char * | pattern ) |
Finds the first occurrence of a pattern in a text using the Boyer-Moore string searching algorithm.
- Parameters
-
| text | The text to search in. |
| pattern | The pattern to search for. |
- Returns
- The index of the first occurrence of the pattern in the text, or -1 if the pattern is not found.
◆ search_kmp()
| int search_kmp |
( |
char * | text, |
|
|
const char * | pattern ) |
Finds the first occurrence of a pattern in a text using the Knuth-Morris-Pratt (KMP) algorithm.
- Parameters
-
| text | The text to search in. |
| pattern | The pattern to search for. |
- Returns
- The index of the first occurrence of the pattern in the text, or -1 if the pattern is not found.
◆ search_kr()
| int search_kr |
( |
char * | text, |
|
|
const char * | pattern ) |
Finds the first occurrence of a pattern in a text using the Karp-Rabin algorithm.
- Parameters
-
| text | The text to search in. |
| pattern | The pattern to search for. |
- Returns
- The index of the first occurrence of the pattern in the text, or -1 if the pattern is not found.
◆ search_naive()
| int search_naive |
( |
char * | text, |
|
|
const char * | pattern ) |
Finds the first occurrence of a pattern in a text using the naive string searching algorithm.
Copyright 2025 Manoel Vilela
Author: Manoel Vilela
Contact: manoel_vilela@engineer.com
Organization: ITA
- Parameters
-
| text | The text to search in. |
| pattern | The pattern to search for. |
- Returns
- The index of the first occurrence of the pattern in the text, or -1 if the pattern is not found.