Question

The alphabet is Ʃ = {a,b}. Give regular expressions that generate the following languages below. Use...

The alphabet is Ʃ = {a,b}. Give regular expressions that generate the following languages below. Use these symbols: Ʃ, a, b, ε, Ø, *, (, ), U.

1) ? = {? | ? contains an odd number of a's and ends with b}

2) ? = {a? b? | ? < 5,? < ?}

3) ? = {? | ? contains the substring ab and contains the substring ba}

4) ? = {? | ? has an odd number of a's and exactly two b's}

Homework Answers

Answer #1

1) b*a(b*ab*ab*)*b*

It can start with a or b.So, b*a

To ensure it contains odd number of a, a(aa)*. But b may come inside a. So, a(b*ab*ab*)* .

It ends with any number of b. So,b*

2) ( a+ aa + aaa+ aaaa)(b+ bb +bbb)

i<5, so, i may be 1 or 2 or 3 or 4 but not 5.

j<i, so, j may be 1 or 2 or 3 but not 4.

3) (a+b)*(ab)(a+b)*(ba)(a+b)*

The start and end may be combinations of a and b. So, (a+b)*

It contains substring (ab) and (ba)

It may have combinations of a and b between substring.

4) a(aa)* bb

It has odd number of a's. So, a(aa)*

It ends with bb. So bb.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
For each of the following regular expressions, give 2 examples of strings that are in the...
For each of the following regular expressions, give 2 examples of strings that are in the language described by the regular expression, and 2 examples of strings that are not in that language. In all cases the alphabet is {a,b}. ab*ba* (a ∪ ε)b* (a ∪ b)ε*(aa ∪ bb)
For each of the following regular expressions, give 2 examples of strings that are in the...
For each of the following regular expressions, give 2 examples of strings that are in the language described by the regular expression, and 2 examples of strings that are not in that language. In all cases the alphabet is {a, b}. ab*ba* (a ∪ ε)b* (a ∪ b)ε*(aa ∪ bb)
Give a regular expression for each of the following sets: a) set of all string of...
Give a regular expression for each of the following sets: a) set of all string of 0s and 1s beginning with 0 and end with 1. b) set of all string of 0s and 1s having an odd number of 0s. d) set of all string of 0s and 1s containing at least one 0. e) set of all string of a's and b's where each a is followed by two b's. f) set of all string of 0s and...
1.1). The alphabet is {a, b}. Give the state diagram of the DFA recognizing the language:...
1.1). The alphabet is {a, b}. Give the state diagram of the DFA recognizing the language: {w | w has an odd number of a’s and at least two b's}. Show the steps! 1.2). Give the state diagram of the DFA which recognizes the complement of the above language in 1.1. Use 1.1 to answer 1.2 **I ONLY NEED HELP WITH 1.2* PLEASE*
1.2 Which of the following statements is wrong?        a). A set is a subset of itself...
1.2 Which of the following statements is wrong?        a). A set is a subset of itself        b). Emptyset is a subset of any set        c). A set is a subset of its powerset        d). The cardinality of emptyset is 0 1.3. Which of the following statements is correct?        a). A string is a set of symbols from an alphabet        b). The length of the concatenation of two strings can           be the same as one of them        c). The length of...
Relations and Functions Usual symbols for the above are; Relations: R1, R2, S, T, etc Functions:...
Relations and Functions Usual symbols for the above are; Relations: R1, R2, S, T, etc Functions: f, g, h, etc. But remember a function is a special kind of relation so it might turn out that a Relation, R, is a function, too. Relations To understand the symbolism better, let’s say the domain of a relation, R, is A = { a, b , c} and the Codomain is B = { 1,2,3,4}. Here is the relation: a R 1,    ...
Strings The example program below, with a few notes following, shows how strings work in C++....
Strings The example program below, with a few notes following, shows how strings work in C++. Example 1: #include <iostream> using namespace std; int main() { string s="eggplant"; string t="okra"; cout<<s[2]<<endl; cout<< s.length()<<endl; ​//prints 8 cout<<s.substr(1,4)<<endl; ​//prints ggpl...kind of like a slice, but the second num is the length of the piece cout<<s+t<<endl; //concatenates: prints eggplantokra cout<<s+"a"<<endl; cout<<s.append("a")<<endl; ​//prints eggplanta: see Note 1 below //cout<<s.append(t[1])<<endl; ​//an error; see Note 1 cout<<s.append(t.substr(1,1))<<endl; ​//prints eggplantak; see Note 1 cout<<s.find("gg")<<endl; if (s.find("gg")!=-1) cout<<"found...
Answer the following questions from the information below a. What are the organization's marketing goals? b....
Answer the following questions from the information below a. What are the organization's marketing goals? b. What are the symptoms of the problem? In other words, which of the organization's marketing goals mentioned in section a., above are not being met? c. What is the organization's problem? Look at the symptoms and make a judgement about what their cause may be. Do not confuse symptoms with problems. Problems cause symptoms. d. Perform a SW/OT analysis: -What are the organization's internal...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT