{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ps2-sol

# ps2-sol - ECE 468 Problem Set 2 Regular expressions and...

This preview shows pages 1–4. Sign up to view the full content.

ECE 468 Problem Set 2: Regular expressions and Finite Automata [ Solutions ] 1. Give a non-deterministic finite automaton for the following regular expression: (( a * b ) * ( bc * ) * ) Answer: We will build this NFA up in pieces. First, let us build NFAs for a * and c * (assume that the leftmost state is the start state): λ a λ c Now let us build a * b and bc * : λ a λ c b b Now we build ( a * b ) * and ( bc * ) * : 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
λ a λ c b b λ λ λ λ And now we concatenate them by attaching the final state of the first NFA to the start state of the second. I’ve numbered the states for convenience in solving the next problem: 4 3 2 λ a 8 7 λ c b 6 b 1 λ λ 5 λ λ λ 2. Give a deterministic version of the finite automaton, using the construction we de- scribed in class. Provide both the graphical representation of the automaton as well as the state transition diagram. Answer: 2
We will build the DFA using the subset construction. Recall that every time we see a λ -transition, we will “split” our pointer and have one pointer take the transition while the other does not. Our “super-states” will consist of every state that has a

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}