Which of the following is/are regular languages?
View worked solution
Answer: A
To determine which of the languages are regular, we analyze each one individually:
-
Language :
We are given .
Let the first symbol of be , so for some string . Then .
Substituting this, any string in can be written as: Since , the middle portion also has length .
Thus, is simply the set of all strings of length that start and end with the same symbol. This can be defined by the regular expression: Since we can write a regular expression for , is regular. -
Language :
.
This language requires comparing the count of 's and 's to ensure they are unequal. Since a finite automaton has finite memory, it cannot keep track of arbitrary counts. Thus, is not regular (it is a deterministic context-free language). -
Language :
.
This language consists of any number of 's followed by any number of 's followed by any number of 's. It can be represented by the regular expression: Thus, is regular.
Therefore, only and are regular languages.
Free practice · Your answers on this page are not saved.
