Homework 1 Solution

Question 1 | Question 2


Question 1

Part a

L(M) = {a, aa, aaa}

Part b

State s eclose(s)
p0{p0, p1, p2}
p1{p1, p2}
p2{p2}
p3{p3, p4}
p4{p4}

Part c

Part d

Note: the labels on the DFA states indicate the corresponding NFA states from Part c that are in the set for that DFA state, e.g., state p3p4 corresponds to {p3, p4}.


Question 2

Part a

{SLASH}{STAR}[^(*/)]*{STAR}{SLASH}

{SLASH}{STAR}(.)*{STAR}{SLASH}

{SLASH}{STAR}([^*]*{STAR}+[^*/])*{STAR}+{SLASH}

{SLASH}{STAR}([^*]|[^/])+{STAR}{SLASH}

{SLASH}{STAR}[^*]*{STAR}+{SLASH}+

Part b

{SLASH}{STAR}([^*]|({STAR}+[^*/]))*{STAR}+{SLASH}    

Last Updated: 2/5/2024     © 2024 CS 536