Design a TM that perform right shift over ∑ = {0, 1}

Data Structure AlgorithmsComputer ScienceComputers

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.

raja
Published on 14-Jun-2021 16:09:34
Advertisements