Consider the design of a Turing Machine which accepts the language consisting of all palindromes of 0’s and 1’s. Initially, the input string is written on to the tape preceded and followed by infinity of blank symbols and the tape head is on the leftmost symbol of the input string.
The above table represents the transitions for such a Turing machine.
Question 156: For a string of length ‘n’, how many transitions will be there before acceptance of the string?
- O(n)
- O(n log(n))
- O(n^2)
- O(n^3)
Solution: Basically, for each pair of symbols (one from the front and one from the reverse), we may have to do O(n) transitions while traversing the tape from left to right and back. Hence for all ‘n/2’ pairs, it would lead to O(n^2) transitions. Hence, the correct answer is option 3.

