recategorized by
1,026 views
4 votes
4 votes

Which of the words below matches the regular expression $a(a+b)^{\ast}b+b(a+b)^{\ast}a$?

  1. $aba$
  2. $bab$
  3. $abba$
  4. $aabb$
recategorized by

4 Answers

6 votes
6 votes

Answer: $\mathbf{(D)}$

As the above Regular expression is the $\mathbf{UNION}$ Of two Regular Expressions in which the first one starts with a and ends with b followed by any number of a and b in between.

In the second part, it must start with b and ends with a, followed by any number of a and b in between.

On checking the options we can easily eliminate a, b and c as they both start and end with the same symbol.

$\therefore$ The answer is $\mathbf D$

edited by
0 votes
0 votes
optino D is the correct.This R.E. represent the string which start a or end with B and vice-versa
Answer:

Related questions

3 votes
3 votes
3 answers
1
6 votes
6 votes
3 answers
3
gatecse asked Sep 13, 2019
751 views
Let $G=(V, E)$ be an undirected simple graph, and $s$ be a designated vertex in $G.$ For each $v\in V,$ let $d(v)$ be the length of a shortest path between $s$ and $v.$ ...
1 votes
1 votes
2 answers
4
gatecse asked Sep 13, 2019
604 views
How many paths are there in the plane from $(0,0)$ to $(m,n)\in \mathbb{N}\times \mathbb{N},$ if the possible steps from $(i,j)$ are either $(i+1,j)$ or $(i,j+1)?$$\binom...