DAT 305 Week 4 Apply – Wk 4 Quiz

0 items
DAT 305 Week 4 Apply - Wk 4 Quiz
DAT 305 Week 4 Apply – Wk 4 Quiz
$8.00
  • Description

DAT 305 Week 4 Apply – Wk 4 Quiz

If the length of the array P is 4 and the length of the array T is 14, how many shifts of P need to be performed in the string searching algorithm?

a. 9

b. 10

c. 11

d. 12

What is the best case for the naive string search algorithm?

a. The first character of the pattern P isn’t present in text T

b. All characters in pattern P are different

c. All characters in text T are different

d. Pattern P is half the size of text T

What is the worst case for the naive string search algorithm?

a. All characters of the pattern P are present in text T

b. All characters of the pattern P and text T are the same

c. Pattern P is of size one

d. Text T is composed of pattern P concatenated N times

How many borders does the string BABBAB have?

a. 0

b. 1

c. 2

d. 3

Using the good suffix rule, if we have pattern P = “BABCABCAB” and we found a mismatch of T[i] with P[6], which index of P should we look into aligning with T[i]?

a. 0

b. 1

c. 3

d. 5

Using only the bad character rule, how many shifts are performed when trying to find P = BAB in T = BACBABCAB?

a. 2

b. 3

c. 5

d. 8

Which string matching algorithms are better suited (or can be extended to be better suited) to work with a set of patterns (check all that apply)?

a. Boyer-Moore

b. Aho-Corasick

c. Knuth-Morris-Pratt

d. Rabin-Karp

Which algorithms (in the implementations described in the course) can achieve a worst–case matching time of O(n) (check all that apply)?

a. Knuth-Morris-Pratt

b. Aho-Corasick

c. Boyer-Moore

d. Rabin-Karp