What is the pre-processing time of the Rabin-Karp Algorithm?
Theta(m^2)
Theta(m log n)
Theta(m)
O(n)
View Answer
Correct Answer: C — Theta(m)
Explanation:
The for loop in the pre-processing step runs m times (length of the pattern). Hence the pre-processing time is Theta(m).
