assignment solutions

# assignment solutions - CS 360 Introduction to the Theory of...

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

CS 360 Introduction to the Theory of Computing Spring 2008 Assignment 1 Solutions Let us Fx the alphabet Σ = { 0 , 1 } for all of this assignment. 1. [3 points] Give a D±A that recognizes the language L 1 = { x Σ * : 1110 is not a preFx of x } . Solution: To maintain information about the preFx of a word, states q 1 , q 11 , q 111 , and q 1110 are intro- duced. All states but q 1110 are accepting. This way D±A accepts an empty string, strings with 3 symbols, and any string that doesn’t start with 1110. q i q 1 q 11 q 111 q 1110 q 1 0 0 0 1 1 1 0 0, 1 0, 1 2. [3 points] Give a D±A that recognizes the language L 2 = { x Σ * : x contains the substring 010, but does not contain the substring 0101 } . Solution: States q 0 , q 01 , and q acc , 010 correspond to symbol 0, two symbols 01, and three symbols 010 having been last read, respectively. States q acc , 0 and q acc , 01 play the same role but they also carry the information that a string contains a substring 010 (that has already been read), and therefore, are accepting. States q i and q acc , i correspond to either no symbol having been read,

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 / 4

assignment solutions - CS 360 Introduction to the Theory of...

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

View Full Document
Ask a homework question - tutors are online