Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For each of these sets, construct a context free grammar which generates it: a)

ID: 3801981 • Letter: F

Question

For each of these sets, construct a context free grammar which generates it: a) The set of even length bit strings which are palindromes with one bit flipped. (e.g., 01100110 is an even length palindrome, and we could flip the second bit to get 00100110.) For each of these sets, construct a context free grammar which generates it: a) The set of even length bit strings which are palindromes with one bit flipped. (e.g., 01100110 is an even length palindrome, and we could flip the second bit to get 00100110.)

Explanation / Answer

S -> 0S0 | 1S1 | B
B -> 0C1 | 1C0
C -> 0C0 | 1C1 |

S is the state symbol for this CFG. In the second rule we make the flip from the palindrome and it is only done once.