String Searching Flashcards

1
Q

(Brute Force) Best case for when searching for only first match?

A

O(m) where m is the length of the pattern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

(Brute Force) What is the performance in all other cases (best case when searching for all matches, as well as average and worst cases)?

A

O(mn) where m is the length of the pattern and n is the length of the text

How well did you know this?
1
Not at all
2
3
4
5
Perfectly