retagged by
1,030 views
5 votes
5 votes
Let $\sum$ = {a, b} and Let L = { w | w contains an equal no of occurrences of substring 'ab' and 'ba' }. Thus aba $\in$ L since 'aba' contains one occurrence of 'ab' and one occurence of 'ba' but abab $\notin$ L.

Then which of the following is TRUE?

Select one:

A. L is regular.

B. L is DCFL but not regular.

C. L is CFL but not regular.

D. L is recursive but not a CFL.
retagged by

3 Answers

Best answer
3 votes
3 votes
L is regular. Because we cannot have two ab in a string without having a ba or vice-verse. So, there are only 3 states possible- one where number of "ab" and "ba" are same, one where number of "ab" is 1 more than number of "ba" and the final one where number of "ba" is 1 more than number of "ab". So, we just need a finite state automata to represent this.
selected by
6 votes
6 votes

There can be no direct step-wise procedure to solve such questions.In the above question, we need to check option wise.

A language is said to be regular if you can construct a finite automaton for it. Here is the  DFA for required language.

Related questions

1 votes
1 votes
1 answer
1
3 votes
3 votes
3 answers
2
Durgesh Singh asked Jul 25, 2017
5,615 views
We can say there are four types of strings in the language so the regex will be: a(a+b)+a + b(a+b)+b + a(a+b)+b + b(a+b)+a Please expleain where I am wrong
0 votes
0 votes
2 answers
3
rohan.1737 asked Aug 17, 2018
745 views
Is there any way to check whether a language is regular or not without using Pumping lemma?