Open In App

Turing Machine to check whether given string is Even Palindrome or not

A string w is called palindrome if reading w from left to right gives the same result as reading w from right to left.An even palindrome has even number of symbols. Examples:
Input : abaaba 
Output :YES

Input :abba
Output :YES

Input :abbaba
Output :NO

Input :Empty String or 
Output :YES 
Basic Representation :
Start of Computation : The tape contains the input string w, the tape head is on the leftmost symbol of w, and the Turing machine is in the start state Q0. Basic Idea : The tape head reads the leftmost symbol of w, deletes this symbol and “remembers” it by means of a state. Then the tape head moves to rightmost symbol and tests whether it is equal to the (already deleted) leftmost symbol.

If they are equal, then the rightmost symbol is deleted, the tape head moves to the new leftmost symbol, and the whole process is repeated . Else the machine can’t reach the final state and the string will be rejected.

Meanings of symbols used: R, L – direction of movement of one unit on either side . B-Blank a, b-symbols whose combination string is to be tested Working Procedure :
Article Tags :