1,830 views
1 votes
1 votes

If r1 and r2 are 2 Regular Expression Such that

r1 = (a+b)*           r2 = (a*+b*+a*b*+b*a*)

What are the different case's in which r1 = r2 ?

Please Explain with an example

2 Answers

0 votes
0 votes

the cases in which both r1 and r2 will be equal are as follows

case1: when r1 generates strings which contains only  'a' for ex- a,aa,aaa...

   then r1 will be equal r2 bcoz r2 can also generate it

case2 :

when r1 generates strings which contains only 'b' for ex- b,bb,bbb...

   then r1 will be equal r2 bcoz r2 can also generate it

case3: when r1 generates strings which contains any no. of a's followed by any no. of b's for ex- ab,abb,aaabb...

   then r1 = r2 bcoz r2 can also generate it

case4:  

when r1 generates strings which contains any no. of b's followed by any no. of a's for ex- ba,bba,bbaa...

   then r1 = r2 bcoz r2 can also generate it

case5: when both generate null string then also r1 = r2

Related questions

2 votes
2 votes
2 answers
2
Kapil asked Jul 8, 2016
1,397 views
The equality of two regular expression is computed in? Give reasons also..Constant Timepolynomial timelogarithmic Polynomial timeExponential time
3 votes
3 votes
2 answers
3
Sunil8860 asked Sep 4, 2017
820 views
1 votes
1 votes
1 answer
4
gate_forum asked May 29, 2016
2,261 views
prove the identity: (a*ab + ba)* a* = (a + ab + ba)*