Let Σ = {a, b}. For a word w ∈ Σ* , let na(x) denote the number of a’s in w and let nb(x) denote the number of b’s in w. Consider the following language: 
L := {xy | x, y ∈ Σ* , na(x) = nb(y)} 
What can we say about L?

(A) L is regular, but not context-free. 

(B) L is context-free, but not regular.

(C) L is Σ*.

(D) None of these.



More Comments

how can it be ∑* ,if number of a = number of b

sumitverma's picture

@somethingnew Read the below line twice :)
L := {xy | x, y ∈ Σ* , na(x) = nb(y)} 
It is na(x) and nb(y) not na(xy) or nb(xy).

@sumitverma , letw= aab

does w ∈ L

if yes, then how would you decompose it to x and y

sumitverma's picture

x= a 

ok got it, thanx

Did not found what you are looking for, Ask your doubt or Help by your contribution

Enter your search keyword:

Search form


Here is a chance to join biggest community of technical Students,
Tutors with FREE learning resources and so much more.
It takes less then 60 seconds.