What is the worst case running time of Rabin Karp Algorithm?

What is the worst case running time of Rabin Karp Algorithm?
A. Theta(n)
B. Theta(n-m)
C. Theta((n-m+1)m)
D. Theta(nlogm)
 
Answer: c
Explanation: The worst case running time of Rabin Karp Algorithm is Theta(n-m+1)m). We write Theta(n-m+1) instead of Theta(n-m) because there are n-m+1 different values that the given text takes on.
 

Tìm kiếm

Back
Top