Which data structure provides efficient string matching with O(m) preprocessing and O(n) search time?
-
A
Naive String Matching
-
B
Knuth-Morris-Pratt Algorithm
Correct answer
-
C
Rabin-Karp Algorithm
-
D
Boyer-Moore Algorithm
Correct answer
B. Knuth-Morris-Pratt Algorithm
16 views
Explanation
The Knuth-Morris-Pratt algorithm provides efficient string matching with linear time complexity.
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ