hwsoln02

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

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

View Full Document Right Arrow Icon
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 (in±nitely) 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
Background image of page 1

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

View Full DocumentRight Arrow Icon
(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
Background image of page 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
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/22/2011 for the course CIS 341 taught by Professor Nakayama during the Fall '10 term at NJIT.

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 Right Arrow Icon
Ask a homework question - tutors are online