Question

Let LL be the language represented by the regular expression Σ∗0011Σ∗\Sigma^* 0011 \Sigma^* where Σ={0,1}\Sigma = \{0, 1\}. What is the minimum number of states in a DFA that recognizes L‾\overline{L} (complement of LL)?

Choose one option
Official answer and solution
Official answer
B
From
Official GATE 2015 answer key

Solution

Construct the minimal DFA for L and invert accepting states to obtain the minimal DFA for the complement language.

The language L=Σ∗0011Σ∗L = \Sigma^* 0011 \Sigma^* contains all binary strings that contain 0011 as a substring.

A minimal DFA recognizing LL requires 5 states tracking prefixes of 0011:

  • State q0q_0: ϵ\epsilon (no progress towards 0011)
  • State q1q_1: matched 0
  • State q2q_2: matched 00
  • State q3q_3: matched 001
  • State q4q_4: matched 0011 (accepting dead state / trap state for substring presence)

To recognize the complement language L‾\overline{L} (all strings not containing 0011 as a substring), we convert the minimal DFA of LL by swapping accepting and non-accepting states (making q0,q1,q2,q3q_0, q_1, q_2, q_3 accepting and q4q_4 non-accepting).

Because complementation on a minimal complete DFA preserves state distinguishability, the resulting DFA for L‾\overline{L} remains minimal with exactly 5 states.

Final answer

B

Common trap

Forgetting that inverting final and non-final states of a complete minimal DFA yields a minimal DFA for the complement without adding any extra states.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2015 Computer Science and Information Technology (CS) Session 3
Question
28 of 65, printed as CS Q.18
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.