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

Give a high-level description of what regular expressions are, and how JavaScript uses them.
Give a high-level description of what regular expressions are, and how JavaScript uses them.
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
Write a program that implements the pseudocode ("informal high-level description of the operating principle of a...
Write a program that implements the pseudocode ("informal high-level description of the operating principle of a computer program or other algorithm") below: 1. Ask the user for the size of their apartment in square meters (size) 2. Convert the size to square feet using the formula: convertedSize = size * 10.764 3. Print out the converted size. Have meaningful prompts and meaningful explanation of any numbers printed.
DATA MINING : Find an interesting data set on the Web. Provide a high level description...
DATA MINING : Find an interesting data set on the Web. Provide a high level description of the data set and minimally give its name, location, number of features (with some discussion of the feature types), and number of entries. Describe how data mining can be applied to it (e.g., for classification, etc.) and describe why you think it is interesting.
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT