Q. What is the time 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)
πŸ’¬ Discuss
βœ… 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.

Explanation by: Mr. Dubey
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.

πŸ’¬ Discussion

πŸ“Š Question Analytics

πŸ‘οΈ
328
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
86%
Success Rate