What exactly is the regular expression for the language of all strings that alternate between 0's and 1's
Answer:
a. $(01)^* + (10)^* + 0(10)^* + 1(01)^*$
b. $(01)^+ + (10)^+ + 0(10)^+ + 1(01)^+$
What exactly is the regular expression for the language of all strings that alternate between 0's and 1's
Answer:
a. $(01)^* + (10)^* + 0(10)^* + 1(01)^*$
b. $(01)^+ + (10)^+ + 0(10)^+ + 1(01)^+$
Well, "all strings that alternate between 0's and 1's" is vague. Does the empty string alternate? What about the strings of length one, $0$ and $1$?
If you say, "the strings from $\{0,1\}^*$ such that every $0$ is either the last letter of the string or is immediately followed by a $1$, and every $1$ is either the last letter of the string or is immediately followed by a $0$," then clearly the empty string, $0$, and $1$ are included and (a) is correct.