Question

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 1s containing exactly two 0s.

Homework Answers

Answer #1

a) set of all string of 0s and 1s beginning with 0 and end with 1.

Regular expression will be 0(0 + 1)*1.

It will starts with 0 and ends with 1. In between then any numbe of occurance 0 or 1 can occur

b) set of all string of 0s and 1s having an odd number of 0s.

Regular expression will be 1*0 (1 + 01*0)*

Here any number of 1's can be possible and then one 0 possible. In parentheses also 2 0's are there. So, total odd zero's possible.

d) set of all string of 0s and 1s containing at least one 0.

Regular expression will be (0 + 1)*0(0 + 1)*

Any number of 0's and 1's can be possible but one 0 is must.

e) set of all string of a's and b's where each a is followed by two b's.

Regular expression will be b*(abb)*b*

When a comes, there are 2 b's must.

f) set of all string of 0s and 1s containing exactly two 0s.

Regular expression will be 1*01*01*

Any number of 1's can possible but exactly 2 0's

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
Let Σ = {0, 1}. Give a regular expression that expresses the language {w | w...
Let Σ = {0, 1}. Give a regular expression that expresses the language {w | w contains exactly two 0s}.
Write the regular expression for the following sets (4.5) 4.1 All strings over {a,b} that are...
Write the regular expression for the following sets (4.5) 4.1 All strings over {a,b} that are odd in length 4.2 All strings over {a,b} whose length is not a multiple of 3 4.3 All strings over a,b that start with aa and end with bb
Which one of the following languages over the alphabet {0,1} is described by the regular expression...
Which one of the following languages over the alphabet {0,1} is described by the regular expression (0+1)* 0 (0+1)* 0 (0+1)* ? a.The set of all strings that begin and end with either 0 or 1 b.The set of all strings containing at most two zeros c.The set of all strings containing at least two zeros. d.The set of all strings containing the substring 00
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...
Give a regular expression for the set of all strings on the alphabet {0,1} with no...
Give a regular expression for the set of all strings on the alphabet {0,1} with no runs of length greater than 3(for example, no substrings 0^i or 1^i with i > 3)
Write the regular expression that will match the following string pattern descriptions. A space character at...
Write the regular expression that will match the following string pattern descriptions. A space character at the beginning of a line Upper case vowel one and more lines with a length of exactly 80 characters A single character that cannot be an alpha or a digit A dollar sign character ‘$’ at the end of the line
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...
Problem 5 Regular Expressions. a) Define a regular expression for all strings of odd length, over...
Problem 5 Regular Expressions. a) Define a regular expression for all strings of odd length, over the alphabet of {0}. b) Define a regular expression for identifiers over the alphabet of {A,B,C,a,b,c,0,1,2,3,4,5,6,7,8,9}, such that an identifier must begin with an alphabetic character and must contain at least one numeric character. c) Try to modify the definition above so that identifiers still begin with an alphabetic character, but after that, it must contain at least one numeric, at least one lower-case...
Create a Regular Expression for the following: The set of all signed or unsigned integers and...
Create a Regular Expression for the following: The set of all signed or unsigned integers and real numbers in decimal notation. No leading zeros should be generated, and real numbers must have at least one digit on both sides of the decimal point. For instance, 3, +3, -3, 0,+0, -0, 0.328, 1009.46, +100.80 and -100.3 are in the language but 123., .25, +, -, 003 are not.
Question 4 Write a regular expression that generates each of the following language constructs: (1) String...
Question 4 Write a regular expression that generates each of the following language constructs: (1) String constants with the following specifications: A string constant consists of any sequence of characters enclosed by the quotation marks: “ and ”       The sequence may be empty.                    The sequence cannot span multiple lines.       Don’t worry about escape characters (assume that they won’t appear in the input).       (2)  Multiple-line comment in C, C++ and JAVA with the following specifications:        The comment consists of any sequence...