Skip to content
Official PYQ · 2016

GATE CS 2016 Set 2 Q16 — Regular Expressions and Finite Automata

Explain with AI
The number of states in the minimum sized DFA that accepts the language defined by the regular expression.

(0+1)∗(0+1)(0+1)∗(0+1)^{*} (0+1) (0+1)^{*}

is ________.
View worked solution

Answer: 2

The given regular expression is:

L=(0+1)∗(0+1)(0+1)∗L = (0+1)^{*} (0+1) (0+1)^{*}

Let us analyze the language LL over the alphabet Σ={0,1}\Sigma = \{0, 1\}:

  • (0+1)∗(0+1)^* represents any string of 00s and 11s (including the empty string ϵ\epsilon).
  • (0+1)(0+1) represents a single symbol, either 00 or 11.

Thus, the regular expression defines the language of all non-empty strings over Σ\Sigma. That is, L=Σ+=Σ∗∖{ϵ}L = \Sigma^+ = \Sigma^* \setminus \{\epsilon\}.

DFA Construction:

To accept all non-empty strings, we need:

  1. An initial state q0q_0 (non-accepting) because the empty string ϵ∉L\epsilon \notin L.
  2. On receiving the first input symbol (00 or 11), the transition goes to an accepting state q1q_1.
  3. Once in q1q_1, any subsequent input (00 or 11) keeps the automaton in q1q_1.

The transition table for this DFA is:

State Input 00 Input 11 Accepting?
→q0\rightarrow q_0 q1q_1 q1q_1 No
∗q1*q_1 q1q_1 q1q_1 Yes

Minimality:

Since LL is neither empty (L≠∅L \neq \emptyset) nor contains all strings (L≠Σ∗L \neq \Sigma^*), any DFA accepting LL must have at least one accepting state and at least one non-accepting state. Therefore, the minimum number of states required is 22.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Regular Expressions and Finite Automata questions