Skip to content
Official PYQ · 2014

GATE CS 2014 Set 2 Q36 — Regular and Context-free Languages

Explain with AI

Let L1={w∈{0,1}∗∣wL_1=\{w\in\{0,1\}^*\mid w  has at least as many occurrences of \text{ has at least as many occurrences of } (110)′s as (110)'\text{s as } (011)′s}(011)'\text{s} \}. Let L2={w∈{0,1}∗ ∣wL_2=\{w \in\{0,1\}^*\ \mid w  has at least as many occurrences of \text{ has at least as many occurrences of } (000)′s as(000)'\text{s as} (111)′s}(111)'\text{s} \}. Which one of the following is TRUE?

Choose one option
View worked solution

Answer: A

To determine the regularity of L1L_1 and L2L_2, we analyze the relationship between their respective substrings.

1. Analysis of L1L_1:

The substrings are 110110 and 011011. Notice that:

  • An occurrence of 110110 represents a transition from a block of 11s (of length ≥2\ge 2) to a 00.
  • An occurrence of 011011 represents a transition from a 00 to a block of 11s (of length ≥2\ge 2).
Because these transitions must alternate, the number of occurrences of 110110 and 011011 in any string ww can differ by at most 11. That is, ∣N(110)−N(011)∣≤1|N(110) - N(011)| \le 1. Since this difference is strictly bounded, a Finite Automaton can track it using a finite number of states. Thus, L1L_1 is regular.

2. Analysis of L2L_2:

The substrings are 000000 and 111111. Let us intersect L2L_2 with the regular language R=0∗1∗R = 0^*1^*:For a,b≥2,L2∩0∗1∗={0a1b∣a≥b}\text{For } a, b \ge 2, \quad L_2 \cap 0^*1^* = \{ 0^a 1^b \mid a \ge b \}This is a well-known non-regular language because it requires comparing two arbitrary independent counts. Since regular languages are closed under intersection, and L2∩RL_2 \cap R is non-regular, L2L_2 cannot be regular.

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

Published
Report a correction
Keep exploringMore Regular and Context-free Languages questions