Regular expression in theory of computation solved examples Part – 2

9014

Last Updated on Sep 30, 2016

This is 2nd Part of Regular expression in theory of computation solved examples. You can also read Regular expression in theory of computation solved examples Part – 1. 

2. Construct a regular expression for all strings which contains no runs of a’s of length greater than two, over input alphabet {a, b, c}.

Solution:

We have the input alphabets ∑ = {a, b, c}.

Here, the resultant regular expression will denote the set of all strings in which no runs of a’s of length greater than two.

Here, a regular expression that contain no ‘a’, one ‘a’, or one ‘aa’ can be written as-

            (b + c)* (λ + a + aa) (b + c)*

Now, as per the problem demand, we have to repeat it. For this, we need to be sure to have atleast one non-a between repetitions.

Thus, the regular expression which fulfill the requirement of the given problem can be written as-

            (b + c)* (λ + a + aa) (b + c)* ((b + c)* (λ + a + aa) (b + c)*)

Previous QuizRegular expression in theory of computation solved examples
Next QuizRegular expression examples in theory of automata Part – 3

1 COMMENT

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.