DFA accepting at most three a symbols

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

Share on WhatsApp

← RGPV CS-501-CBGS Theory of Computation December 2020 Solved Paper

Question

Design DFA that accept all strings with at most 3 a’s.

Asked in: CS-501 | December 2020 | 4(a)

Answer

Assume alphabet {a,b}. Let qᵢ count a symbols for i=0,1,2,3 and q₄ represent four or more. Start q₀; F={q₀,q₁,q₂,q₃}. On a, δ(qᵢ,a)=qmin(i+1,4); on b, δ(qᵢ,b)=qᵢ. The state q₄ is a rejecting sink. By induction after each prefix the state index is the smaller of four and the number of a symbols. Thus ε and ababa are accepted, while aaaa is rejected. The same construction works for larger alphabets by looping on every symbol other than a.

DFA accepting at most three a symbols
DFA accepting at most three a symbols

← RGPV CS-501-CBGS Theory of Computation December 2020 Solved Paper

Discussion

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

Sign in to participate in the discussion.

Join the discussion