In: Computer Science
Which one of the following REs represents the language of all binary strings having two consecutive 0s and two consecutive 1s?
a. (0 + 1)*00(0 + 1)* + (0 + 1)*11(0 + 1)*
b. (0 + 1)*0011(0 + 1)* + (0 + 1)*1100(0 + 1)*
c.(0 + 1)*(00(0 + 1)*11 + 11(0 + 1)*00)(0 + 1)*
d. 00(0 + 1)*11 + 11(0 + 1)*00
The correct option is c.
c.(0 + 1)*(00(0 + 1)*11 + 11(0 + 1)*00)(0 + 1)*
Set of all binary strings having two consecutive 0s and two consecutive 1s implied
Anything 00 Anything 11 Anything + Anything 11 Anything 00 Anything
So,it is quite clear, that , the option c correctly represents the language of all binary strings having two consecutive 0s and two consecutive 1s.
The reasons why the other options are incorrect :
Option a. (0 + 1)*00(0 + 1)* + (0 + 1)*11(0 + 1)* represents , those strings which either have 00 or 11 as substring.so it's not correct answer.
Option b. (0 + 1)*0011(0 + 1)* + (0 + 1)*1100(0 + 1)* represents , those strings which either have 0011 or 1100 as substring, so it's not correct answer.
Option d. 00(0 + 1)*11 + 11(0 + 1)*00 represents , those strings which starting with 00 and ending with 11 or starting with 11 and ending with 00 , so it's not correct answer.