1.

What is the auxiliary space complexity of Z algorithm for pattern searching (m = length of text, n = length of pattern)?(a) O(n + m)(b) O(m)(c) O(n)(d) O(m * n)I got this question in an online quiz.I'm obligated to ask this question of Searching topic in division Searching of Data Structures & Algorithms II

Answer»

Correct OPTION is (B) O(m)

Easy explanation - Z ALGORITHM is an efficient PATTERN searching algorithm as it searches the pattern in linear time. It an auxiliary space of O(m) for maintaining Z array.



Discussion

No Comment Found

Related InterviewSolutions