Skip to content
Official PYQ · 2003

GATE CS 2003 Q14 — Regular Expressions and Finite Automata

Explain with AI

The regular expression 0∗(10∗)∗0^*(10^*)^* denotes the same set as

Choose one option
View worked solution

Answer: A

To find which regular expression is equivalent to 0∗(10∗)∗0^*(10^*)^*, let us analyze the language generated by it.

Step 1: Analyze the given expression 0∗(10∗)∗0^*(10^*)^*

Let the alphabet be Σ={0,1}\Sigma = \{0, 1\}.

  • The term 0∗0^* generates any number of 00s (including the empty string ϵ\epsilon).
  • The term (10∗)∗(10^*)^* generates any sequence of blocks, where each block starts with a 11 followed by any number of 00s.

Any string over {0,1}∗\{0, 1\}^* can be uniquely decomposed into an initial sequence of 00s, followed by zero or more occurrences of a 11 and its succeeding 00s. For example, the string 0010110000101100 can be parsed as: 00⏟0∗⋅10⏟10∗⋅1⏟10∗⋅100⏟10∗\underbrace{00}_{0^*} \cdot \underbrace{10}_{10^*} \cdot \underbrace{1}_{10^*} \cdot \underbrace{100}_{10^*} Thus, the regular expression 0∗(10∗)∗0^*(10^*)^* generates all possible strings over {0,1}\{0, 1\}, which means: 0∗(10∗)∗=(0+1)∗0^*(10^*)^* = (0+1)^*

Step 2: Analyze Option A: (1∗0)∗1∗(1^*0)^*1^*

  • The term (1∗0)∗(1^*0)^* generates zero or more blocks, where each block consists of any number of 11s followed by a single 00.
  • The term 1∗1^* generates any trailing sequence of 11s.

Any string over {0,1}∗\{0, 1\}^* can be decomposed into blocks of 11s ending with a 00, followed by any remaining 11s at the end. For example, the string 0010110000101100 can be parsed as: 0⏟1∗0⋅0⏟1∗0⋅10⏟1∗0⋅110⏟1∗0⋅0⏟1∗0⋅ϵ⏟1∗\underbrace{0}_{1^*0} \cdot \underbrace{0}_{1^*0} \cdot \underbrace{10}_{1^*0} \cdot \underbrace{110}_{1^*0} \cdot \underbrace{0}_{1^*0} \cdot \underbrace{\epsilon}_{1^*} Thus, this expression also generates all possible strings over {0,1}\{0, 1\}: (1∗0)∗1∗=(0+1)∗(1^*0)^*1^* = (0+1)^* Since both expressions represent (0+1)∗(0+1)^*, they denote the same set.

Step 3: Eliminate other options

  • Option B: 0+(0+10)∗0+(0+10)^*
    This expression cannot generate any string containing consecutive 11s (such as "11"), because every 11 must be immediately followed by a 00. Thus, it is not equal to (0+1)∗(0+1)^*.
  • Option C: (0+1)∗10(0+1)∗(0+1)^*10(0+1)^*
    This expression only generates strings that contain the substring "10". It cannot generate strings like "0", "1", or "111". Thus, it is not equal to (0+1)∗(0+1)^*.

Therefore, Option A is the correct choice.

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

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