String Algorithms
Print this page

Problems

  1. For each of the following cases find the number of comparisons to find the index (first occurrence) of the pattern P in the text T.
  2. a) P =cat, T = bcbcbcbc

    b) P= bbb T= aabbaabbaabbaabbb

    c) P= xxx T= xyxxyxxxyxxxyxxxxy

  3. What is the complexity of the brute force string-matching algorithm in the best case.
  4. Write a procedure to count the number of the time the word 'the' appears in a given text .
  5. Find the output of The FailureFunction for the pattern P = aabbaababbabaa
  6. Can we find the occurrence of the pattern P in the text T by computing FailureFunction for the string PT which is the concatenation of the strings P and T. If so, then write an algorithm for that and what is the running time of your algorithm?
  7. Give best case inputs (both pattern and text) for KMP string matching algorithm.
 
Prev
First | End