in Theory of Computation
644 views
2 votes
2 votes

Let $\Sigma = \{a, b\}$. For a word $w \: \: \in \Sigma^*$ let $n_a(x)$ denote the number of $a$'s in $w$ and let $n_b(x)$ denote the number of $b$'s in $w$. Consider the following language:

$L:=\{ xy \mid x, \: y \in  \Sigma^*, \: \: n_a(x) = n_b(y)\}$

What can we say about $L$?

  1. $L$ is regular, but not context-free
  2. $L$ is context-free, but not regular
  3. $L$ is $\Sigma^*$
  4. None of these
in Theory of Computation
644 views

2 Answers

0 votes
0 votes
Answer B)

As here number of a's in x= number of b's in y

Now, x could be aaabb

y could be bbb

it satisfying condition

So, it is a NCFL
edited by

6 Comments

3
3

yes number of b in x , and number of a in y could be different

example bbb could be a string with only b in x

bbaaa - bb is part that b in x and aaa is part that a in y

bbabbb - here say bbabb in x and b in y [here we have to maintain a restriction, we cannot take any thing as x and anything as y]

b3 an bn-1 - here b3an-1 in x part and abn-1 in y part. right?

though it is not making any problem in final string getting (a+b)*

0
0
Thanks for the answer but I can't understand properly please explain it more clear that help me alot.
0
0
see link of @Praveen Sir
0
0
Its okay with your answer with proper explanation and I understand it clearly.

Thanks a lot.
0
0
Answer should be $(C)$ and it’s language is $\sum^*$ .
0
0
0 votes
0 votes

Answer:

Related questions