





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






3.6.1: Figure 3.19 in the exercises of Section 3.4 computes the failure function for the KMP algorithm. Show how, given that failure function, we can construct, from a keyword b1b2...bn an n + 1-state DFA that recognizes .*b1b2...bn, where the dot stands for "any character." Moreover, this DFA can be constructed in O(n) time. Answer: Take the string "abbaabb" in exercise 3.4.3-3 as example, the failure function is:
It is obviously that with the known f(n), this DFA can be constructed in O(n) time. 3.6.2: Design finite automata (deterministic or nondeterministic) for each of the languages of Exercise 3.3.5. 3.6.3: For the NFA of Fig. 3.29, indicate all the paths labeled aabb. Does the NFA accept aabb? Answer:
NFA State DFA State a b {2} B B ∅ {4} C ∅ C **DFA
Transition table NFA State DFA State a b** {0} A B A {0,1} B C B {0,1,2} C C D {0,2,3} D C D DFA
3. Transition table NFA State DFA State a b {0,1,2,3} A A A DFA 3.7.2: use Algorithm 3.22 to simulate the NFA's:
2. NFA Transition table NFA State DFA State a b {0,1,2,3,4,5,8,9,10,11} A B C {1,2,3,4,5,6,8,9,10,11} B B C {1,2,3,4,5,7,8,9,10,11} C B C DFA
Transition table NFA State DFA State a b {0,1,2,3,4,6,7,9,10} A B C {1,2,3,4,5,6,7,9,10} B B C {1,2,3,4,6,7,8,9,10} C B C DFA