Turing machine accepting an even number of ones

December 4, 2026 · Team EasyExamNotes · 1 min read (est.) · 0 comments

Share on WhatsApp

← RGPV CS-501 Theory of Computation December 2025 Solved Question Paper

Question

Design a Turing machine accepting strings over {0,1} with an even number of 1s.

Asked in: CS-501 | December 2025 | 7(b)

Answer

Use states E (even), O (odd), accept and reject. E is initial. The tape alphabet is {0,1,□}. Scan the input from left to right without changing its symbols. A zero preserves parity; a one toggles parity. At the first blank, halt according to parity.

State Read 0 Read 1 Read □
E (E,0,R) (O,1,R) (accept,□,R)
O (O,0,R) (E,1,R) (reject,□,R)

For 1011 the sequence is E→O→O→E→O→reject. For 1010 it is E→O→O→E→E→accept. The empty word is accepted because zero is even.

Correctness

After scanning any prefix, E holds exactly when the number of ones in that prefix is even. This is true initially and is preserved by the transitions for 0 and 1. At the blank the entire word has been scanned, so the acceptance decision is correct. The head advances once per symbol and halts after reading the blank, using n+1 transitions for input length n.

Turing machine accepting an even number of ones diagram
Turing machine accepting an even number of ones — original illustration

← RGPV CS-501 Theory of Computation December 2025 Solved Question Paper

Discussion

Ask a question, share your thoughts or report an error.

Sign in to participate in the discussion.

Join the discussion