cs50_4solved
cs50_4solved
Enumeraor
In summary: a) Yes, a Turing machine can write the blank symbol s on its tape
because it is part of the tape alphabet IT. b) No, the tape alphabet I cannot be
the same as the input alphabet as T always includes the blank symbol
while does not. c) Yes, a Turing machine's head can be in the same location
in two successive steps if it has a "stay" movement option (N), which is a
logical extension to the classic Turing machine definition. d) Yes, a Turing
machine can contain just a single state, which is both the initial state and a
halting state. Such a machine would halt immediately, accepting an empty or
trivial language.
a)
2. Scan the tape and mark the first one that has not been marked. If no unmarked
one is found, reject.
3. Move the head back to the front of the tape and go to stage one.
4. Move the head back to the front of the tape. Scan the tape to see if any
unmarked 1s remain. If none are found, accept; otherwise, reject."
{ww contains an equal number of Os and 1s}
{ww contains twice as many Os as 1s}
1.Scan the tape and mark the first one which has not been marked. If no unmarked
l'sare found go to stage five. Otherwise move the head back to the start of the
tape
2. Scan the tape until an unmarked zero is found, mark the zero, if no zero's are
found reject
3. Scan the tape once more until an unmarked zero is found, mark the zero, if no
zero's are found reject
4. Move the head back to the start of the tape and go to stage 15. Move the head
back to the start of the tape. Scan the tape to see if any unmarked zero's are found.
If none are found accept, otherwise reject.
{w w contains twice as many Os as ls}
{ww does not contain twice as many Os as ls}
1. Scan the tape and mark the first one which has not been marked. If no
unmarked one's are found go to stage five. Otherwise move the head back to the
start of the tape
2. Scan the tape until an unmarked zero is found, mark the zero, if no zero's are
found accept
3. Scan the tape once more until an unmarked zero is found, mark the zero, if no
zero's are found accept
4. Move the head back to the start of the tape and go to stage 1 5. Move the head
back to the start of the tape. Scan the tape to see if any unmarked zero's are found.
If none are found reject, otherwise accept.