Regular expression in theory of computation solved examples

15378

5. Find the regular expression for all strings over input alphabets ∑ = {0, 1} ending in either 010 or 0010.

Solution:

We have the input alphabets ∑ = {0, 1}

Here, the resultant regular expression will denote the set of all strings over the given input alphabets ∑ = {0, 1} which must either ends with the substrings 010 or 0010.

To fix this problem, first write the regular expression which represent the set of all strings over the given input alphabets ∑ = {0, 1}. It is-

(0 + 1)*

Now, the regular expression which fulfill the requirement of the given question can be written as-

(0 + 1)*(010 + 0010)

 

Note: In all regular expression which are represented in this problem set symbol ‘+’ denotes the ‘or’ condition, which means we get an acceptable string either first expression or other which are separated by symbol ‘+’.  At some books and these types of problem solution you found ‘∪’ or ‘|’. Hence each symbol has the same meaning.

Previous QuizWhat is SEO-Definition with List of all major search engine
Next QuizRegular expression in theory of computation solved examples Part – 2

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.