StreakPeaked· Practice

ExamsGATETechnical

Let \(L_1 = \{w \in \{0,1\}^* \mid w\text{ has at least as many occurrences of }110\text{ as }011\}\). Let \(L_2 = \{w \in \{0,1\}^* \mid w\text{ has at least as many occurrences of }000\text{ as }111\}\). Which one of the following is true?

  1. L1 is regular but not L2
  2. L2 is regular but not L1
  3. Both L1 and L2 are regular
  4. Neither L1 nor L2 are regular

Correct answer: Both L1 and L2 are regular

Solution

The difference between the counts of 110 and 011 depends only on local transitions in the string and can be captured by a finite-state machine. Similarly, the difference between counts of 000 and 111 can be determined by a finite automaton using bounded memory. Therefore both languages are regular.

Related GATE Technical questions

⚔️ Practice GATE Technical free + battle 1v1 →