CS124, Fall 2010
Assignment #8.5
DUE: Tuesday, Dec. 7.
- Schneider & Gersting, Chapter 11 exercise 14 (page 552); the problem is to
design a Turing machine to decrement a number in unary notation.
Recall we did unary increment in class; use a similar
strategy here.
- Run the applet at this website (push the "Launch xTuringMachine"
button to run it). Select the "Increment.txt" example from the pop-up
menu. Exercise: use the rules given for the Increment.txt example
to write down a state-transition diagram
(see, e.g., figure 11.8 on page 539 of Schneider & Gersting) for this
Turing machine. Note this is a Turing machine to do binary
increment. (Also one point of notation: in the applet, the #-sign
is used to denote blank tape squares, while Schneider
& Gersting use b for the same purpose.)
- Adapt the state-transition diagram of the previous problem
to design a Turing machine to do binary decrement. That is,
for example,
if the content of the tape is initially 1010, after a run it should
be 1001. Do not worry about leading zeros. For example,
if the input is 1000, it's okay for the output to be 0111.
(Modest challenge (optional): Get rid of possibly leading zeros.)
Hand in:
-
Clearly written solutions.
Back to CS
124 Home Page