hw2-sol - CSE596 Fall 2011: Solution To Homework 2...

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

View Full Document Right Arrow Icon
CSE596 Fall 2011: Solution To Homework 2 September 25, 2011 1. (a) A one-taped Turing machine that recognizes { 0 n 1 n 0 n | n 0 } works as follows : i. It first scans the input to check if it is in the form of 0 * 1 * 0 * . If not, REJECT. ii. It scans the input from left to right to check if all 0’s and 1’s are marked. If yes, ACCEPT. iii. Otherwise, it tries to mark one unmarked 1 and two unmarked 0’s, one before the unmarked 1 and one after. If it cannot find such unmarked 0’s or 1’s (i.e., either there is no more unmarked 1’s or there is no more 0’s before or after the un- marked 1), REJECT. iv. Go to Step ii. (b) Here is a 1-tape Turing machine that recognizes the language { ww | w ∈ { 0 , 1 } * } . i. It first scans the input to check if every symbol on the input tape is 0 or 1. If no, REJECT. ii. It checks if all symbols on the tape are marked with either or - . If yes, go to Step iv. iii. Otherwise, it scans the input from left to right to mark the first unmarked symbol with a and the last unmarked symbol with a - . If there is only one unmarked sybmol left, REJECT. Go to Step ii. iv. It scans the input from left to right to check if the first symbol marked with is the same as the first symbol marked with - . If not, REJECT. If yes, cross off both symbols with * . 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
v. If there are only * left on the tape, ACCEPT. Otherwise go to Step iv. (c) Here is a 1-tape machine that recognizes the language { ww R | w { 0 , 1 } * } . i. It scans the input from left to right and compare the first and the last unmarked symbols. If there is only one unmarked symbol left on the tape or they are not the same, REJECT (and if either of them is not 0 or 1, REJECT as well). Mark both symbols with * . ii. If there is no more unmarked symbol on the tape, ACCEPT.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 10/01/2011.

Page1 / 5

hw2-sol - CSE596 Fall 2011: Solution To Homework 2...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online