McqMate

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) |

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. |

1.2k

0

Do you find this helpful?

18

View all MCQs in

Design and Analysis of AlgorithmsNo comments yet

- What is the worst case time complexity of KMP algorithm for pattern searching (m = length of text, n = length of pattern)?
- What is the auxiliary space complexity of Z algorithm for pattern searching (m = length of text, n = length of pattern)?
- Rabin Karp algorithm and naive pattern searching algorithm have the same worst case time complexity.
- The naive pattern searching algorithm is an in place algorithm.
- Is Coppersmith-Winograd algorithm better than Strassen’s algorithm in terms of time complexity?
- What is the time complexity of the brute force algorithm used to find the length of the longest palindromic subsequence?
- Which of the following sorting algorithm has best case time complexity of O(n2)?
- What is the worst case time complexity of a quick sort algorithm?
- What is the time complexity of Kruskal’s algorithm?
- Worst case is the worst case time complexity of Prim’s algorithm if adjacency matrix is used?