• Home
  • Textbooks
  • Algorithms : design and analysis
  • String Matching

Algorithms : design and analysis

Harsh Bhasin

Chapter 18

String Matching - all with Video Answers

Educators


Section 1

I. Multiple Choice Questions

00:56

Problem 1

In which of the following 'string matching' is used?
(a) DNA matching
(b) Text editors
(c) Finding musical patterns from multimedia databases
(d) All of the above

Joanna Quigley
Joanna Quigley
Numerade Educator
02:49

Problem 2

What would be the complexity of 'naive string matching', if the text $T$ is of length ' $n$ ' and the pattern $P$ is of length ' $m$ '?
(a) $O\left(\mathrm{~m}^2\right)$
(c) $O\left(n^2\right)$
(b) $O(m(n-m))$
(d) None of the above

James Chok
James Chok
Numerade Educator

Problem 3

What is the best case complexity of Rabin-Karp algorithm?
(a) $O(n)$
(c) $O\left(m^2\right)$
(b) $O(n+m)$ in the best case
(d) None of the above

Check back soon!

Problem 4

What is the worst case complexity of Rabin-Karp algorithm?
(a) $O(m(n-m))$
(c) $O\left(n^2\right)$
(b) $O\left(\mathrm{~m}^2\right)$
(d) None of the above

Check back soon!
12:07

Problem 5

What is the complexity of string matching using deterministic automata?
(a) $O(n)$
(c) $O\left(n^2\right)$
(b) $\mathrm{O}(\mathrm{m})$
(d) None of the above

Chris Trentman
Chris Trentman
Numerade Educator
01:17

Problem 6

What is the complexity of Knuth-Morris-Pitt algorithm?
(a) $O(n)$
(c) $O\left(n^2\right)$
(b) $O(n m)$
(d) None of the above

James Kiss
James Kiss
Numerade Educator
07:08

Problem 7

Which of the following data structures is best suited when many of the strings to be matched have the common prefix with the first string?
(a) Trie
(c) Do not try
(b) Try
(d) Trial

Anas Venkitta
Anas Venkitta
Numerade Educator

Problem 8

Which of the following is the trie of all the possible suffixes of a string?
(a) Suffix tree
(c) Suffix-Prefix
(b) Suffix array
(d) Prefix tree

Check back soon!

Problem 9

Which of the following is also called a prefix tree?
(a) Tries
(c) Binary search tree
(b) Suffix tree
(d) None of the above

Check back soon!
00:53

Problem 10

Which language is accepted by a deterministic finite acoeptor?
(a) Regular
(c) English
(b) Irregular
(d) Spanish

Christopher Stanley
Christopher Stanley
Numerade Educator
00:53

Problem 11

Which of the following is accepted by a non-deterministic finite acceptor?
(a) Regular
(c) English
(b) Irregular
(d) Spanish

James Kiss
James Kiss
Numerade Educator
02:06

Problem 12

Which of the following is true?
(a) Corresponding to every DFA, there is an NFA
(b) Corresponding to every NFA, there is a DFA
(c) Both
(d) None of the above

James Kiss
James Kiss
Numerade Educator
02:06

Problem 13

Which of the following is true?
(a) An NFA can have a NULL transition
(b) An NFA can go to more than one states on giving an input
(c) Both of the above
(d) None of the above

James Kiss
James Kiss
Numerade Educator

Problem 14

Which data structure is used in string matching?
(a) DFA
(c) Prefix tree
(b) Trie
(d) All of the above

Check back soon!

Problem 15

Which is the most efficient string matching algorithm?
(a) Knuth-Morris-Pitt
(b) Rabin-Karp
(c) Naive
(d) All of the above are equally efficient

Check back soon!

Problem 16

Which of the following is not used in string matching?
(a) Longest common subsequence
(c) Naìve string matching
(b) Master theorem
(d) All of the above

Check back soon!