I came across a question to create a regular expression to check whether there are even number of b's in a string of language {a,b}. The expression I came up with is (a+ba*b)*. However I found the solution online to be a*(ba*ba*). Is there any difference? If any where?
Also I know that (a+b)* is equivalent to (a*b*)*. So my solution comes out to be (a*(ba*b))*. So why that extra a*?
(a+b)*
is not equivalent to(a*b*)
. Please double-check all your statements. Proof-read the formatted output, and consider using Markdown to typeset your notation more clearly. 2. What have you tried? Have you tried to look for a string that is accepted by your expression but not by the other one, or vice versa? Have you taken a look at closure properties, to see how to compute the set difference between two regexps? (continued) $\endgroup$ – D.W.♦ Sep 3 '15 at 21:33(a+ba*b)*
mean(a+(ba*b))*
or((a+b)a*b)*
? 4. I can't tell what "check whether for even number of b's in a language of {a,b}" means. Can you please edit to rewrite that? Thank you! $\endgroup$ – D.W.♦ Sep 3 '15 at 21:33