Substring Search Help Center

Learn more

Warning: The hard deadline has passed. You can attempt it, but you will not get credit for it. You are welcome to try it as a learning exercise.

To specify an array or sequence of values in an answer, separate the values in
the sequence by whitespace. For example, if the question asks for the first
ten powers of two (starting at 1), then the following answer is acceptable:

1 2 4 8 16 32 64 128 256 512

If you wish to discuss a particular question and answer in the forums, please
post the entire question and answer, including the seed (which can be used by
the course staff to uniquely identify the question) and the explanation (which
contains the correct answer).

Question 1

(seed = 762985)
Consider the Knuth-Morris-Pratt DFA for the following string of length 8:

B A B A B B B C

What is sequence of values in the row of the DFA corresponding to
the character 'A'? For reference, here is the partially-completed DFA:

0 1 2 3 4 5 6 7
----------------------
A ? ? ? ? ? ? ? ?
B 1 1 3 1 5 6 7 1
C 0 0 0 0 0 0 0 8

Question 2

(seed = 121999)
Suppose that you run the Boyer-Moore algorithm (using only the mismatched character heuristic)
to search for the pattern

H E T H I S H

in the text

F R E N C H W H I C H I S H E T H I S I S H E T H I S H E L

What is the sequence of characters in the text that is compared with the
last character in the pattern?

Question 3

(seed = 970398)
What is the Rabin-Karp hash function of text[5..13] over the decimal
alphabet with R = 10 and using the modulus Q = 167?

j 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
--------------------------------------------------------------------
text[j] 4 1 4 5 8 1 1 ? ? ? ? 5 9 6 5 5 9 8 1 2

The digits labeled with a ? are suppressed (and are not needed to solve the problem).
Assume that the hash function of text[4..12] is 39 and that you have precomputed
100000000 (mod 167) = 66.
    
You cannot submit your work until you agree to the Honor Code. Thanks!