{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hwsoln02

# hwsoln02 - CS 341 Foundations of Computer Science II Prof...

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

CS 341: Foundations of Computer Science II Prof. Marvin Nakayama Homework 2 Solutions 1. DFA M = ( Q, Σ , δ, q 1 , F ) , where Q = { q 1 , q 2 , q 3 } Σ = { a, b } transition function δ is given by a b q 1 q 1 q 2 q 2 q 1 q 3 q 3 q 1 q 3 q 1 is the start state F = { q 1 , q 3 } is the set of accept states. 2. There are (infinitely) many correct DFAs for each part below. (a) A DFA that recognizes the language A = { ε, b, ab } is q 1 q 2 q 3 q 4 q 5 q 6 q 7 q 8 a b a b a b a, b a, b a, b a, b a, b There are simpler DFAs that recognize this language. Can you come up with one with only 4 states? 1

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

View Full Document
(b) A DFA that recognizes the language B = { w Σ | n a ( w ) mod 3 = 1 } is q 1 q 2 q 3 a a a b b b (c) A DFA that recognizes the language C = { w Σ | w = saba for some string s Σ } is q 1 q 2 q 3 q 4 a b a b a b a b (d) Since D = C , the complement of C , we can convert the DFA for C into a DFA for D by swapping the accept and non-accept states: q 1 q 2 q 3 q 4 a b a b a b a b 2
(e) A DFA for E = { w Σ | w begins with b and ends with a } is q 1 q 2 q 3 q 4 b a a b a b a, b (f) A DFA for F = { w Σ | n a ( w ) 2 , n b ( w ) 1 } is q 1 q 2 q 3 q 4 q 5 q 6 q 7 a b a b a b 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 ]}

### Page1 / 5

hwsoln02 - CS 341 Foundations of Computer Science II Prof...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online