recategorized by
112 views
1 votes
1 votes

Which of the following languages is/are regular? (Mark all the appropriate choices)

  1. Set of binary strings containing equal number of $"00"$ and $"11"$
  2. Set of binary strings containing equal number of $"01"$ and $"10"$
  3. Set of binary strings containing equal number of $"01"$ and $"11"$
  4. Set of binary strings containing $1,000,000$ number of $"11"$
recategorized by

2 Answers

Best answer
2 votes
2 votes
Option D is regular because at max we need to count till 1 million which though large is STILL a finite number.

Option A is not regular. This can be proved using pumping lemma or intuitively we can consider an input string going like $000000\ldots$ Now to match the following $11’s$ we need to maintain the count of “00’s” which can go to an infinite value.

Like option A, option C is also not regular. Instead of “000000\ldots” just replace with “01010101\ldots”.

But option B is different. It is in fact regular. This is because if we consider a sequence like “01010101\ldots” having say $n$ number of “01”s, the sequence will also have $n-1$ number of “10”s making the difference of “01” and “10” just “1”. This is in fact true for any binary string – the difference of the number of “01” and “10” will be either “0”, “1” or “-1”. So, a finite automata can accept this language. The language asked is equivalent to any binary string starting and ending with the same bit. Regular expression for this is $0(0+1)^*0 + 1(0+1)^*1+ 1 + 0 + \epsilon$

So, correct answer: B, D.
selected by
1 votes
1 votes

A regular language is a language that can be expressed with a regular expression or deterministic or non-deterministic finite automata or state machine. A language is a set of strings that are made up of characters from a specified alphabet, or set of symbols. Regular languages are a subset of the set of all strings. 

$\text{Theorem:}$ Every finite language is regular.

$\text{Proof:}$ If $L$ is the empty set, then it is defined by the regular expression $\varnothing$ and so is regular. If it is any finite language composed of the strings $s_{1}, s_{2},\dots, sn $ for some positive integer n, then it is defined by the regular expression $: s_{1} \cup s_{2} \cup \dots s_{n}.$ So it too is regular.

Now, $L = \{ \text{Set of binary strings containing equal number of "01" and "10"} \}$

$\implies L = \{\varepsilon,0,1,010,101,0110,1001,01110,10001,\dots\}$

References:

So, the correct answer is $B;D.$

edited by
Answer:

Related questions

1 votes
1 votes
1 answer
1