Question: 1 . Write a regular expression for each of the following: Note: Intuitive Reading of Regular Expressions Concatenation = = is followed by | =

1. Write a regular expression for each of the following:
Note: Intuitive Reading of Regular Expressions
Concatenation ==is followed by
|==or
*==zero or more occurrences
0 or 11 or 101
Answer: 0|11|101
all strings over {a,b} that start with an a
Answer: a(a|b)*
only 0s
all binary strings
all binary strings except empty string
all strings over the alphabet {0,1} that begin with 1, end with 1
all strings over the alphabet {0,1} that end with 00
all strings over the alphabet {0,1} that contain at least three 1s
all strings over the alphabet {0,1} that contain at least three consecutive 1s
all strings over the alphabet {0,1} that contain the substring 110
all strings over the alphabet {0,1} that don't contain the substring 110
Answer: (0|10)*1*
all strings over the alphabet {0,1} that contain at least two 0s but not
consecutive 0s
all strings over the alphabet {0,1} that have at least 3 characters, and the third
character is 0
Answer: (0|1)(0|1)0(0|1)*
all strings over the alphabet {0,1} that the number of 0s is a multiple of 3
all strings over the alphabet {0,1} that start and end with the same character
odd length
all strings over the alphabet { a, b } with ab as substring

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!