Downloaded 85 times





![Naïve string matching algorithm Pseudocode:
{
n = length(text);
m = length(patter,);
limit = n-m;
j = 0, k = 0;
array_Shift[];
for(i = 0; i <= limit; i++)
{
j = 0;
k = i;
for(j = 0; j <= m AND str[k] == pat[j]; j++)
k++;
if(j >= m)
Add i to array_Shift;
}
return array_Shift;
}](https://image.slidesharecdn.com/naivestringmatchingalgorithm-170127123554/75/Naive-String-Matching-Algorithm-Computer-Science-6-2048.jpg)


The document explains the naive string matching algorithm, which involves sliding a pattern over a text to find matches by comparing characters one by one. When a match is found, it returns the starting index of that match, and continues to search for subsequent matches. A pseudocode for the algorithm is also provided, with a link for further reading.





![Naïve string matching algorithm Pseudocode:
{
n = length(text);
m = length(patter,);
limit = n-m;
j = 0, k = 0;
array_Shift[];
for(i = 0; i <= limit; i++)
{
j = 0;
k = i;
for(j = 0; j <= m AND str[k] == pat[j]; j++)
k++;
if(j >= m)
Add i to array_Shift;
}
return array_Shift;
}](https://image.slidesharecdn.com/naivestringmatchingalgorithm-170127123554/75/Naive-String-Matching-Algorithm-Computer-Science-6-2048.jpg)
