- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Design a TM which recognizes palindromes over = {a, b}

## Algorithm

**Step 1 -** If there is no input, reach the final state and halt.

**Step 2 -** If the input = “a‟, then traverse forward to process the last symbol = “a‟. Convert both a‟s to B‟.

**Step 3 -** Move left to read the next symbol.

**Step 4 -** If the input = “b‟, replace it by B and move right to process its equivalent “B‟ at the rightmost end.

**Step 5 -** Convert the last ’b’ to ‘B’.

**Step 6 -** Move left and process step 2 – 5 until there are no more inputs to process.

**Step 7 -** If the machine reaches the final state after processing the entire input string, then the string is a palindrome that halts the machine.

## Turing Machine

The turing machine is as follows −

The Turing machine, M is given by M = (Q, Σ, Γ, δ, q0, B, F)

Where,

Q = {q0, q1, q2, q3, q4, q5, q6, q7, q8}

Σ = {a, b}

Γ = {a, b, B}

δ ⇒ Given by the above mentioned transition diagram,

q0 = {q0}

B = {B}

F = {q8}

Consider a string aabbaa, as shown below −

- Related Questions & Answers
- Design a PDA which recognizes the language
- Construct a TM that accepts even-length palindromes over the alphabet {0,1}?
- Design a TM that perform right shift over ∑ = {0, 1}
- Design a TM for an equal number of a’s and b’s must follow a
- Design a TM that increments a binary number by 1
- Construct a TM recognizing strings of the form an bn cn| n≥1 over = {a, b, c}
- Design a TM to compute addition of two unary numbers
- Design a push down automaton for L = {wwR | w ∈ {a, b}+}?
- Python a += b is not always a = a + b
- Larger of a^b or b^a in C++
- Find FIRST & FOLLOW for the following Grammar.\nS → A a A | B b B\nA → b B\nB → ε
- Python Program to Find All Numbers which are Odd and Palindromes Between a Range of Numbers
- Design Turing Machine to reverse string consisting of a’s and b’s
- Construct a Finite Automata for the regular expression ((a+b)(a+b))*.
- Construct a TM for adding 1 to a binary natural number?