Give a regular expression for strings over the alphabet 0 1

Give a regular expression for strings (over the alphabet {0, 1} that contain the string: 101 as a prefix or as a suffix (or both).

Solution

(101)(0+1)*(101)

Here add 101 as suffx and prefix both as this will give option to have it has either suffix or prefix or both and as there is no specification what should be between hence we will provide (0+1)* which signifies any number of 0 or 1 and any patttern.

 Give a regular expression for strings (over the alphabet {0, 1} that contain the string: 101 as a prefix or as a suffix (or both).Solution(101)(0+1)*(101) Here

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site