What regular expression is represented by the finite state machines shown below? is the starting state.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The answer is ( a b ∗ a ∣ c d ∗ c ) ∗ .
S 0 is the starting state and the accepting state. From the starting state we can either choose "c" or "a" to transition to S 1 or S 2 , respectively. This clues us into the fact that the answer will probably have an "OR" operation.
Case 1: we go to S 1 and generate a "c". From S 1 to get back to the accepting state ( S 0 ), we can go straight to S 0 with a "c" transition, generating the string "cc" or we can loop back in on S 1 with "d" however many times and then do the "c" transition to the accepting state, generating a string with a "c", then any number of "d"s, then one "c".
Case 2: we go to S 2 and generate an "a". From S 2 to get back to the accepting state ( S 0 ), we can go straight to S 0 with an "a" transition, generating the string "aa" or we can loop back in on S 2 with "b" however many times and then do the "a" transition to the accepting state, generating a string with an "a" then any number of "b"s and then an "a".
After we complete either case 1 or case 2, we can start the whole thing over and add on another part of the string using case 1 or 2, and this is why there is a star surrounding the OR term.
For example, we could complete case 1 with 2 iterations of "d" to make "cddc" and then back at q 0 , we could do a case 2 with three iterations of the "b" transition to produce the string "cddcabbba".