GATE Computer ScienceVery hardGATE CSE

A Turing machine (blank B, halts when no rule applies or in state acc) has rules: q0: a→(q1,B,R), b→(q2,B,R), B→(acc,B,S); q1 and q2: a,b→(same state,same symbol,R); q1: B→(q3,B,L); q2: B→(q4,B,L); q3: a→(q5,B,L), B→(acc,B,S); q4: b→(q5,B,L), B→(acc,B,S); q5: a,b→(q5,same symbol,L), B→(q0,B,R). It starts in q0 on the leftmost symbol of the input abbaabba. How many steps (rule applications) does it perform before halting?

  1. A. 37
  2. B. 51
  3. C. 58
  4. D. 45

Correct answer: D. 45

The machine strips matching end symbols round by round (round cost grows by about 4 per shrink); simulating the full tape yields 45 steps and it ends in acc.

More Theory of Computation questions

Exams that ask this topic