Question

The Naive Pattern Searching algorithm has a worst-case time complexity of O(M

  • N , where 'M' is the length of the pattern and 'N' is the length of the text. This occurs when:
A The pattern is very short.
B The pattern is very long.
C All characters in the text and pattern are distinct.
D Many characters match before a mismatch, but the pattern shifts only by one.
E The pattern is not found in the text.
Practice Next

Hey! Ask a query