8.6k views
0 votes
solve this simple question 1) Let S = {a, bb, bab, abaab} be a set of strings. Are abbabaabab and baabbbabbaabb in S*? Does any word in S* have odd number of b’s?

User Jemlifathi
by
4.4k points

1 Answer

3 votes

Answer: a.

S = {aa ab ba bb}

This clearly shows that that every string that belongs to this language has an even length including 0 length.

This language can be depicted as following

S* = {∧ aa ab ba bb aaaa aaab aaba aabb bbaa . . .}

Regular Expression for this can be

RE = (aa+ab+ba+bb)*

So S* contains all the strings of a's and b's that have even length. This means all strings of even length.

Step-by-step explanation:

b.

S* contains all possible strings of a's and b's that have length divisible by 3

This means some of the possible strings examples are:

aaa, bbb, aaabbb, aaaaaa, bbbbbb and so on.

Length divisible by 3 means the length of string such as aaa is 3 which is divisible by 3, also aaaaaa has length 6 which is divisible by 3

This should be something like this:

(( a + b ) ^3)*

For example a^3 = aaa which is divisible by 3

Regular expression can be:

RE of S* = (aaa + bbb)*

For example string bbbbbbbbb has length 9 which is divisible by 3

So the language is

S* = { ∧ aaa bbb aaabbb aaaaaa aaaaaabbb...}

Step-by-step explanation:

User Svangordon
by
6.2k points