GATE / CS ARCHIVE

GATE CSE 2017 SET 2 / QUESTION 25

GATE CSE 2017 Set 2 Q25

Theory of Computation · Finite Automata · Full GATE CSE 2017 Set 2 paper

GATE 2017 Set 2, Q25 1 mark · NAT
Report issue

Finite Automata

Question 25, GATE 2017: Find the minimum number of states of a complete DFA accepting L={w1 a w2 | w1,w2∈{a,b}*, |w1|=2, |w2|≥3}.
Tap to enlarge
Answer & solution

Official answer: 8.0

Our answer: 8

Step through it (2 parts)

1. The first two symbols may be arbitrary, the third must be a, and at least three further symbols must follow. Thus accepted strings have length at least 6 and third symbol a.

2. Construct three states for having read 0,1,2 prefix symbols. From the third of these, a enters a suffix-count state and b enters a rejecting dead state. Use four suffix states for 0,1,2,at least 3 symbols after the required a. The last is accepting and loops on both symbols; the dead state also loops on both. Total: 3+4+1=8 states.

3. To prove minimality, the seven nondead states have distinct shortest accepting continuation lengths 6,5,4,3,2,1,0. For two states, a shortest accepting suffix from the one with smaller required length is too short from the other, distinguishing them. The dead state has no accepting continuation at all. All eight are necessary.

Original paper, page 10 · Answer key