Loading practice questions
What is the time complexity of Z algorithm for pattern searching (m = length of text, n = length of pattern)?
Correct Answer: A — O(n + m)
Explanation:
Z algorithm is an efficient pattern searching algorithm as it searches the pattern in linear time. It has a time complexity of O(m + n) where m is the length of text and n is the length of the pattern.