100 likes | 909 Views
Turing Machines – More Examples. Lecture 24 Section 3.1 Wed, Oct 17, 2007. Turing Machine as Language Processor. Design a Turing machine that will shift the input string one space to the right, leaving a blank in the leftmost cell. Strategy. Strategy:
E N D
Turing Machines – More Examples Lecture 24 Section 3.1 Wed, Oct 17, 2007
Turing Machine as Language Processor • Design a Turing machine that will shift the input string one space to the right, leaving a blank in the leftmost cell.
Strategy • Strategy: • Read the first symbol and write a blank. • Move right. • Read the second symbol and write the first symbol. • Move right. • Read the third symbol and write the second symbol.
Strategy • Move right. • Continue in this way until a blank is read. • Write the last symbol.
0 0, R _ 0, R 0 _, R _ L _ R q0 acc 0 1, R 1 0, R _ R 1 _, R _ 1, L 1 1, R The Turing Machine
Another Language Processor • Design a Turing Machine that will duplicate the input string. • Replace w with w#w.
Turing Machine as Calculator • Design a Turing Machine that will add 1 to the input. • For example, if the input is 100111, the output will be 101000. • Design a Turing Machine that will subtract 1 from the input.
Turing Machine as an Enumerator • Design a Turing Machine that will print on its tape all binary strings. • Design a Turing Machine that will print all binary strings that contain an even number of 0s and an odd number of 1s.
Turing Machine as an Enumerator • Design a Turing Machine that will print all binary strings all of whose prefixes contain at least as many 0s as 1s (balanced parentheses).