#need help theory of computation: regular expression

1 messages · Page 1 of 1 (latest)

merry gate
#

got these questions and i cant seem to get it right, someone please come to my rescue

Consider the language consisting of all strings ending with exactly two a’s, with Σ = {a, b}. Give an RE for this language.

•    ab*ab*
•    (a + b)*aa(a + b)*
•    (a + b)*aa
•    a*ba*b

Consider the language consisting of all strings containing exactly two a’s, with Σ = {a, b}. Give an RE for this language.

•    b*ab*ab*
•    a*ba*b
•    ab*ab*
•    (a*b*)aa(a*b*)*
smoky tulip
#

I can help a little, not good with the theory stuff

#

There's two questions here

#

What are those examples provided underneath the questions?

muted eagle
#

To me, the answer would be, (a+b)aa, if (a+b) means any number of a's and b's, ending with two a's. The syntax is a little different here. For the second question: any number of b's then an a, any number of b's then an a then any number of b's. that way there is exactly 2 a's and any number of bs in any position.

smoky tulip
#

What I mean is the occurence of the string

#

First question is (a + b)aa for the multiple choice the second should be the first three examples

muted eagle
#

So I'm doing this paper now, my professor would require the text to be written (a+b)aa and babab

#

But the b can be in any position, before the first a, in the middle, and at the end

smoky tulip
#

it can be abab babab

#

there's an italic b on the second example

#

not sure if that counts

muted eagle
#

I'm not sure

smoky tulip
#

if you can do multiple statements that solves everything actually

#

like multiple expressions

#

er, not quite

#

well (a(b)asteriska(b)asterisk) or ((b)asteriska(b)asteriska(b)*) or the latter

#

four options to do the expression