22C:2 From CAT Scans to Google: Great Ideas in Computing
Homework 5. Due Thursday, October 12, 2006
1. Write a Turing machine (TM) program that solves a simple problem,
and test it on "Suzanne Britton's Turing Machine Simulator"
.
Suggested problems:
- Write a TM that can reverse strings of 1's and 0's. For example, if the
tape initially contains 0110001, your machine should halt with 1000110 on the tape.
Note that it must be a general machine and should work no matter what string
it is given as input.
- Assuming the tape contains a string of some combinations A's, B's, and C's,
write a TM that halts and prints "Y" if the numbers of A's equals the number of
B's and also equals the number of C's, and halts and writes "N" otherwise.
- Write a TM that does multiplication. Assuming that the tape starts
with N '1's followed by the symbol '*' followed by M '1's, followed by the
symbol '=', your machine should halt with N*M '1's after the '=' sign.
For instance, given input 111*11=, your machine should halt
with 111*11=111111 showing on the tape. (Actually, it would also
be okay to halt with something else to the left of the '=' sign.
E.g. *11=111111. It's only important what's after the '=' sign.)
- Asumming the tape contains a string of 0's and 1's, write a TM
that halts and prints "Y" if the string can be split into two equal
halves, and halts and writes "N" otherwise. For example, on
input 011011 the machine should print "Y" since the two
halves are "011". On input 01110110, the machine should print "N".
Submit your homework by emailing me the text of your TM program.
Your email must also include a short description of what your program does (or what
you intend for it to do). If it doesn't work, say something about what
you think the problem is or what you were stuck on.