Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CSE 30151 Theory of Computing: Homework 3 NFAs and ..., Study notes of Introduction to Computing

CSE 30151 Theory of Computing: Homework 3. NFAs and Regex. Version 2: Sept. 8, 2017. Instructions. • Unless otherwise specified, all problems from “the ...

Typology: Study notes

2021/2022

Uploaded on 09/12/2022

youcangetme
youcangetme 🇬🇧

5

(4)

214 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE 30151 Theory of Computing: Homework 3
NFAs and Regex
Version 2: Sept. 8, 2017
Instructions
Unless otherwise specified, all problems from “the book” are from Version 3. When a problem in
the International Edition is different from Version 3, the problem will be listed as V3:x.yy/IE:x.zz,
where x.zz is the equivalent number. When Version 2 has a different number, it will be listed as
V3:x.yy/V2:x.zz. If either IE or V2 does not have a matching number, the problem text will be
duplicated.
You can prepare your solutions however you like (handwriting, L
A
T
E
X, etc.), but you must submit them
in PDF. You can scan written solutions in the library or using a smartphone (with a scanner app like
CamScanner). It is up to you to ensure that submissions are legible.
Please give every PDF file a unique filename.
If you’re making a complete submission (all problems), name your PDF file netid-hw2.pdf, where
netid is replaced with your NetID.
If you’re submitting some problems now and other problems later, name your file netid-hw2-123.pdf,
where 123 is replaced with just the problems you are submitting now.
If you use the same filename twice, only the most recent version will be graded.
The time of submission is the time the most recent file was uploaded.
If you use L
A
T
E
X and want to draw something like a state diagram, consider using the tikz package.
A reference document is on the website under “Assignments”.
Submit your PDF file in Sakai. Don’t forget to click the Submit (or Resubmit) button!
Practice Problems
These problems are from the book, and most have solutions listed for them. They are listed here for you to
practice on as needed and any answers you generate should not be submitted. You are free to discuss these
with others, but you are not allowed to post solutions to any public forum.
1. 1.7a,f NFA state diagrams with fixed number of states
2. 1.11 NFAs need only 1 accept state
3. 1.16a NFA to DFA
4. 1.10b,c Regex to NFA
5. 1.20 Regex to strings
6. 1.21a DFA to regex
7. 1.28 regex to NFA
1
pf2

Partial preview of the text

Download CSE 30151 Theory of Computing: Homework 3 NFAs and ... and more Study notes Introduction to Computing in PDF only on Docsity!

CSE 30151 Theory of Computing: Homework 3

NFAs and Regex

Version 2: Sept. 8, 2017

Instructions

  • Unless otherwise specified, all problems from “the book” are from Version 3. When a problem in the International Edition is different from Version 3, the problem will be listed as V3:x.yy/IE:x.zz, where x.zz is the equivalent number. When Version 2 has a different number, it will be listed as V3:x.yy/V2:x.zz. If either IE or V2 does not have a matching number, the problem text will be duplicated.
  • You can prepare your solutions however you like (handwriting, LATEX, etc.), but you must submit them in PDF. You can scan written solutions in the library or using a smartphone (with a scanner app like CamScanner). It is up to you to ensure that submissions are legible.
  • Please give every PDF file a unique filename.
    • If you’re making a complete submission (all problems), name your PDF file netid-hw2.pdf, where netid is replaced with your NetID.
    • If you’re submitting some problems now and other problems later, name your file netid-hw2-123.pdf, where 123 is replaced with just the problems you are submitting now.
    • If you use the same filename twice, only the most recent version will be graded.
    • The time of submission is the time the most recent file was uploaded.
  • If you use LATEX and want to draw something like a state diagram, consider using the tikz package. A reference document is on the website under “Assignments”.
  • Submit your PDF file in Sakai. Don’t forget to click the Submit (or Resubmit) button!

Practice Problems

These problems are from the book, and most have solutions listed for them. They are listed here for you to practice on as needed and any answers you generate should not be submitted. You are free to discuss these with others, but you are not allowed to post solutions to any public forum.

  1. 1.7a,f NFA state diagrams with fixed number of states
  2. 1.11 NFAs need only 1 accept state
  3. 1.16a NFA to DFA
  4. 1.10b,c Regex to NFA
  5. 1.20 Regex to strings
  6. 1.21a DFA to regex
  7. 1.28 regex to NFA

CSE 30151 Fall 2017

Book Exercises

These problems are found in the text book and are to be answered and submitted by each student. You are to solve them yourself. Use of solution manuals from any source or shared solutions is a violation of the ND Honor Code. You are also not allowed to show your solutions to another student.

  1. (5 points) 1.17 Build an NFA and convert to DFA
  2. (5 points) 1.12 Language to DFA and regular expression
  3. (5 points) 1,24a,b,f,g,h Finite State Transducers (FSTs): DFAs with outputs
  4. (5 points) 1.25 Formal definition of FSTs
  5. (5 points) 1.26 Define sample FSTs

Non-book Problems

The following problems are not found in the text book. You are to solve them yourself. Use of any resource you used other than the text book or class notes must be cited. You are also not allowed to show your solutions to another student.

  1. Consider the two DFAs M 1 and M 2 in Figs. 1.6 and 1.8 respectively. Build a DFA that takes the union of the two languages.
  2. (5 points) Convert the following NFA called M to a DFA called M’. Identify all formal components of the DFA. For δ′, either a state diagram or transition table is sufficient.

p q (^) r s

a,b

b a,b^ a,b

  1. (5 points) Do the same on the following graph to convert to a DFA. Note that there are εs in this. Use the approach of Theorem 1.39 and explicitly show the corresponding E(q) as the set of states reachable by 0 or more ε edges from state q.

p q (^) r

b,ε

a,c

b

b,c

c,ε

  1. (5 points) Assume regular languages L 1 and L 2 are accepted by DFAs M 1 and M 2 , where M 1 = (S, Σ, δ 1 , s 1 , F 1 ), S = {s 1 , ..., sn}, and M 2 = (R, Σ, δ 2 , r 1 , F 2 )., R = {r 1 , ..., rm}. Define L 3 = L 1 − L 2 as {w|w is in L 1 but not in L 2 }. Show by construction of an NFA that L 3 is regular. Describe informally how your construction works.
  2. (5 points) For the DFA M 4 in Fig. 1.12 in the book, create a FA M 4 R that accepts the reverse of any string accepted by this machine. Show that state sequences you would go through for the string “aaabba” for M 4 and the string “abbaaa” for M 4 R.
  3. (5 points) Now consider a generalization of the above question. Given any NFA N that accepts some language L, describe the process you would use to get a DFA M that accepts any string that is either in L or LR, where LR is the language of any string that is the reverse of L, i.e. if “abc” is in L, then “cba” is in LR. Make sure you consider the case where N has multiple accept states.