195k views
1 vote
Construct a regular expression that recognizes the following language of strings over the alphabet {0 1}:

The language consisting of the set of all bit strings that start with 00 or end with 101 (or both).

Syntax

The union is expressed as R|R, star as R*, plus as R+, concatenation as RR.
Epsilon is not supported but you can write R? for the regex (R|epsilon).

User Paleozogt
by
5.6k points

1 Answer

6 votes

Answer:

00(01)*+|(01)*+101|00(01)*+101

Rest detail is in explanation.

Step-by-step explanation:

(01)* means all the strings comprising of 0 and 1

when we add + the set includes empty sets as well. and for or we use union, and this can be done using the | sign.

And for concatenation, we have like 00(01)* etc. Hence, the above regular expression.

User Silia
by
5.5k points