Homework 9

Due Thursday, December 8
5 points.
  1. (1 point) Show the KMP prefix mapping function for the pattern "aaaaaa".

  2. (1 point) Show the KMP prefix mapping function for the pattern "abacabad".

  3. (1 point) The KMP matching algorithm is running with pattern "abacabad" and text "abacabac". What is the value of the matches variable (see A Knuth-Morris-Pratt String Matcher) when it completes?

  4. (1 point) For sweep-line algorithms, what kind of operations does the sweep-line status data structure need to support?

  5. (1 point) What other kind of data structure is needed for general sweep-line algorithms?