Here is how the TM works to accomplish the given task:
- The TM machine reads the first letter from x. Call it "a". It
writes a "blank" at this place. (Marking)
- It then moves to the # symbol and reads what is written on the
next cell ("b") and writes "blank" there.
- It moves back to the first blank it wrote and writes "b" there
and moves right to the next cell and reads what is written there
("a1") and writes a blank at this place.
- Moving towards the right it finds a blank symbol and writes a
there and moves to the next cell and reads what is written there
("b1") and writes a blank here.
- It proceeds, in the same way, to exchange each letter of the
strings x and y and finally halts.
You
can comment below the answer in case of any doubts and I will be
happy to help.
Please give a
thumbs up if the answer could be of help!
All
the best!