Question: 4 String matching with gaps In string matching with gaps the pattern P can contain a gap character * that can match any string

4 String matching with gaps In string matching with gaps the pattern P can contain a gap character * that can match any string (of arbitrary length even length zero). An example of such a string is P= ab* ac * a, which occurs in the text T = bababacbcca in two ways: T: b ab ab bcc a P: ab * a or T: bab ab ac bcc a P: ab * a There are no gap characters in the text-only in the pattern. Solve the following exercises. 4.1 Show how to build a finite automaton that can find an occurrence of a gapped pattern in P in a text T in O(n) matching time. 4.2 Give an algorithm to find an occurrence of a pattern P containing gap characters in a text T in time O(n+m). That is, preprocessing time + matching time should be O(n+m)).
Step by Step Solution
3.43 Rating (162 Votes )
There are 3 Steps involved in it
set string input S a b c m7 for each automation Si S construct factor auto... View full answer
Get step-by-step solutions from verified subject matter experts
