cs373 fa10 hw2sol

# cs373 fa10 hw2sol - Solutions for Problem Set 2 CS 373:...

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

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.

Unformatted text preview: Solutions for Problem Set 2 CS 373: Theory of Computation Assigned: September 7, 2010 Due on: September 14, 2010 at 10am Homework Problems Problem 1 . [Category: Design] Design an NFA for the language D given in Problem 1.48. You need not formally prove the correctness of your construction, but your construction should be clear and understand- able. Solution: Language D is the collection of all binary strings that have an equal number of 01 and 10 occurrences. Observe that we have one occurrence of 01 when there is switch from a sequence of 0s to a sequence of 1s. Similarly there is an occurrence of 10 when there is a switch from a sequence of 1s to a sequence of 0s. Thus, since the runs of 0s and 1s alternate in a binary string, a string has equal number of 0s and 1s iff the strings begins and ends in the same symbol. This yields the following NFA. Formally, the q q 1 q 2 q 3 q 4 0,1 1 1 0,1 0,1 NFA N = ( { q ,q 1 ,q 2 ,q 3 ,q 4 } , { , 1 } ,δ,q , { q ,q 2 ,q 4 } ) where δ is given by δ ( q , 0) = { q 1 ,q 2 } δ ( q , 1) = { q 2 ,q 3 } δ ( q 1 , 0) = { q 1 ,q 4 } δ ( q 1 , 1) = { q 1 } δ ( q 3 , 0) = { q 3 } δ ( q 3 , 1) = { q 3 ,q 4 } For all other values of q and a ∈ { , 1 } ∪ { } , δ ( q,a ) = ∅ . Problem 2 . [Category: Design] Problem 1.31. Hint: Show that if M is a DFA recognizing A then there is an NFA recognizing A R . Solution: Given a DFA M = ( Q, Σ ,δ,q ,F ) recognizing A , the NFA N recognizing A R will be obtained by “reversing” the transitions and switching the initial and final states. Formally,“reversing” the transitions and switching the initial and final states....
View Full Document

## This note was uploaded on 10/04/2011 for the course CS 373 taught by Professor Viswanathan,m during the Fall '08 term at University of Illinois, Urbana Champaign.

### Page1 / 3

cs373 fa10 hw2sol - Solutions for Problem Set 2 CS 373:...

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

View Full Document
Ask a homework question - tutors are online