- 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 that perform right shift over ∑ = {0, 1}

## Problem

Shift the input string right by one place and design a Turing Machine (TM) that can perform right shift over ∑ = {0, 1}.

## Solution

Refer an **algorithm **given below **to design a TM** −

**Step 1**− Move right side to the last character from the initial character.**Step 2**− If the character is „0‟, replace it with „B‟ and move one step right to replace the immediate „B‟ to „0‟.**Step 3**− If the character is „1‟, replace it with „B‟ and move one step right to replace the immediate „B‟ to „1‟.**Step 4**− After processing as above, move left one step to perform step 2 or 3 on the next right most unprocessed character.**Step 5**− Perform step 4 until all the characters are processed.

The diagram given below shows the respective TM −

## Description of Turing Machine

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

Where,

Q = {q0, q1, q2, q3, q4, q5}

Σ = {0, 1}

Γ = {0, 1, B}

q0 = {q0}

B = {B}

F = {q5}

Here,

q0 → skips the initial 0‟s and 1‟s and moves the head of the TM to the last character. q1 → the unprocessed rightmost character is replaced by B.

q2 → on processing the input „0‟, q2 immediately replaces the „B‟ as „0‟ and takes left.

q3 → on processing „1‟, q3 replaces immediately the „B‟ as „1‟ and moves left.

q4 → takes a left position to process the next character

q5 → halts if no more input characters are available.

- Related Questions & Answers
- Design a TM that increments a binary number by 1
- Design a TM which recognizes palindromes over = {a, b}
- Construct a TM that accepts even-length palindromes over the alphabet {0,1}?
- Design a TM to compute addition of two unary numbers
- Construct a TM recognizing strings of the form an bn cn| n≥1 over = {a, b, c}
- Shift right in a BigInteger in Java
- Left Shift and Right Shift Operators in C/C++
- Explain JavaScript Bitwise NOT, Left shift and Right shift?
- Construct a TM for adding 1 to a binary natural number?
- Bitwise right shift operators in C#
- Bitwise right shift operator in Java
- Convert RE 1(0+1)*0 into equivalent DFA.
- Design DFA for language over {0,1} accepting strings with odd number of 1’s and even number of 0’s
- How to rescale a tensor in the range [0, 1] and sum to 1 in PyTorch?
- Bitwise Right/ left shift numbers in Arduino