+1 vote
in Data Structures & Algorithms II by (110k points)
What is the worst case time complexity of KMP algorithm for pattern searching (m = length of text, n = length of pattern)?

(a) O(n)

(b) O(n*m)

(c) O(m)

(d) O(log n)

I had been asked this question during an online exam.

This interesting question is from Searching topic in section Searching of Data Structures & Algorithms II

1 Answer

+1 vote
by (614k points)
selected by
 
Best answer
Correct choice is (c) O(m)

The explanation is: KMP algorithm is an efficient pattern searching algorithm. It has a time complexity of O(m) where m is the length of text.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...