1 / 19

Exercises for Chapter 2

Exercises for Chapter 2. Summary for the Quiz. Some numbers 199  less than 100  55 Conclusion There are students who did read textbook at least for review; Most submitted answers are actually correct; Rethinks on teaching method. Explanations on RE.

zinnia
Download Presentation

Exercises for Chapter 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Exercises for Chapter 2

  2. Summary for the Quiz • Some numbers • 199  less than 100  55 • Conclusion • There are students who did read textbook at least for review; • Most submitted answers are actually correct; • Rethinks on teaching method

  3. Explanations on RE • A regular expression defines a set of strings(language); • A regular expression states the common pattern(structure) of the strings that belong to its language; • For the same set of strings, there could be several RE definitions for it; • Explanation of three operations • (顺序;选择;重复);

  4. Example of RE • {a, b, c} • Defining a set of strings, where each string should starts with “a” and ends with “c”; • Defining a set of strings, if “a” appears in one string, “c” should appear right after “a”;

  5. From RE to NFA • The generated NFA could be different, but they are equivalent; • The only criteria for judging whether the generated NFA is correct: L(RE) = L(NFA) • You can follow the general rules; • There are some shortcuts;

  6. S0 S0 S S Rules ■ is a regular expression,L()={ } ■  is a regular expression,L()={  } ■ for any c , c is a regular expression, L(c)={c} c

  7. Rules ■ ( A ), L( (A) ) = L(A), no change; ■ A B, L( A B )= L(A)L(B) NFA(B) NFA(A) 

  8. Rules ■ ( A ), L( (A) ) = L(A), no change; ■ A | B,L( A | B )=L(A)L(B) NFA(A)    NFA(B) 

  9. Rules ■ A* ,L( A*) = L(A)*  NFA(A)   

  10. Attention • The rules introduced above are effective for those NFAs that have one start state and one terminal state; • Any NFA can be extended to meet this requirement; …… NFA ……    

  11. Quiz • (a|b)*abb(a|b)* • Follow the rules  a     b   b b a

  12. Quiz • (a|b)*abb(a|b)* • Follow the process in the textbook (a|b)*abb(a|b)* (a|b)* (a|b)* abb a a a b b     b b

  13. Quiz • (a|b)*abb(a|b)* • The NFA without  edge; a a b a b 3 4 2 1 b b

  14. {1} --- S0; {1,2} --- S1; {1,3} --- S2; {1,4} --- S3; {1,2,4} --- S4; {1,3,4} --- S5;

  15. Minimizing DFA • Current groups:{S0,S1,S2}, {S3,S4,S5} Splitting {S0, S1,S2}  {S0,S1},{S2} • Current groups:{S0,S1},{S2} , {S3,S4,S5} Splitting {S0, S1}  {S0},{S1}

  16. Minimizing DFA • Current groups:{S0},{S1},{S2}, {S3,S4,S5} • Splitting {S3, S4,S5}  {S3,S4,S5}

  17. Minimized DFA • {S0},{S1},{S2}, {S3,S4,S5} • {S0} ---- 0; {S1} --- 1 ; • {S2} ---- 2; {S3,S4,S5} --- 3; a b 00 1 00 1 2 1 2 1 3 3 3 3*

  18. You should know how to do these problems!!!!

More Related