Question

In: Computer Science

Give a high-level description of a TM (how it moves its head around, etc.) that takes...

Give a high-level description of a TM (how it moves its head around, etc.) that
takes a string of the form x#y where x, y ∈ {a, b}* are guaranteed to have |x| = |y| ≥ 1,
and swaps x and y (i.e., it should halt with y#x written on the tape). For example, if the
input is abb#bab then the output should be bab#abb. Do not give a state diagram. Use the
“marking” idea to keep track of where the TM left off in each half.

Solutions

Expert Solution

Here is how the TM works to accomplish the given task:

  1. The TM machine reads the first letter from x. Call it "a". It writes a "blank" at this place. (Marking)
  2. It then moves to the # symbol and reads what is written on the next cell ("b") and writes "blank" there.
  3. 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.
  4. 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.
  5. 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!




Related Solutions

Al is twirling a ball horizontally around his head. The ball moves in a circle because...
Al is twirling a ball horizontally around his head. The ball moves in a circle because there is a force on the ball pulling it outward. tension in the string continuously pulls the ball inward. once the ball starts moving, circular motion is its natural tendency. the ball’s force is perpendicular to its acceleration.
Suppose the firm moves from a high-wage to a low-wage country but its level of output...
Suppose the firm moves from a high-wage to a low-wage country but its level of output remains constant at 200 units per day. How will its total employment change?
Provide a high level (cartoon or box model) description of how an ICP-MS and how an...
Provide a high level (cartoon or box model) description of how an ICP-MS and how an IC work.
Give a brief description of the diaphragm box, how it works and its common types.
Give a brief description of the diaphragm box, how it works and its common types.
5. The head football coach is concerned about high cholesterol level of the assistant coaches. In...
5. The head football coach is concerned about high cholesterol level of the assistant coaches. In an attempt to improve the situation a sample of seven coaches is selected to take part in a special program in which each coach is given a special diet by the school trainer. After six months each coach’s cholesterol level is checked again. At the .01 level of significance, can we conclude that the program led to a change in the cholesterol levels? Coach...
Write a description of how blood moves through the body. In your answer, be sure to...
Write a description of how blood moves through the body. In your answer, be sure to include the           following: -Involved anatomical structures of the heart -What role veins, arteries and lungs play in the process -Description and details of any involved systems or circuits
1. If the Moon takes 27.3 days to complete its orbital path around the Earth, and...
1. If the Moon takes 27.3 days to complete its orbital path around the Earth, and the orbit has a radius of 3.8 x 108 meters, what is the Earth's Mass? Express your answer using scientific notation with three significant figures. (Note: Earth's Mass has been listed on other materials and questions. The value for the Moon's orbital period has been modified so it's close to that value, but not exactly that value. Make sure to do the calculations for...
Use C language Level 2 Problem description n (n is odd) people sitting around a round...
Use C language Level 2 Problem description n (n is odd) people sitting around a round table playing a game. In this situation, everyone has a left neighbour and a right neighbour. At the beginning, each of them is holding a whiteboard with an integer number. Now, they are playing a game consisting of several rounds. In each round, everyone will first look at the numbers of his/her left neighbour and right neighbour, then calculate the average of the two...
A description of how Underprivileged/low-income children/adolescents live around the world
A description of how Underprivileged/low-income children/adolescents live around the world
Provide a high-level description of dollar value LIFO and discuss why many firms use it.
Provide a high-level description of dollar value LIFO and discuss why many firms use it.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT