CS 321 Fall 2015 Final Review Questions. To be discussed in the Extra Recitation on Sunday Dec 6th, 4-6pm in KEC 1001. Most questions are from HWs/quizzes and we will only provide solutions *sketches* to the other questions. 0. Sort the following language classes from the smallest to the largest. Use < for strict subset relation, and == for equality: e.g.: d == b ... < f < e = ... < ... (a) context-free languages (b) languages recognizable by DFAs (c) languages recognizable by NFAs (d) regular expressions (e) languages recognizable by PDAs (f) languages recognizable by DPDAs (g) recursively enumerable languages (h) recursive languages (i) context-sensitive languages (j) ambiguous context-free languages (k) languages generated by right-linear grammars (l) languages recognized by TMs (m) languages recognized by NTMs 1. Use induction to prove that the following languages are *not* (inherently) ambiguous. Hint: first you need to come up with a CFG for the language (what is the definition of "inherently ambiguous"?), and then prove by induction on |w| that there is a single parse tree for each w. (a) { a^n b^n | n >= 0} (b) infix expressions, where operands are a, b, or c, and operators are + or * (c) postfix expressions, same operands/operators as above 2. For each of the following languages, (1) decide whether it's regular (2a) if regular then draw DFA or NFA (2b) if not, use pumping lemma to prove it. (a) { a^n b^m c^n | m, n >= 0} (b) { a^n | n is prime } (c) { a^n | n % 3 = 0 } (d) same number of ab's and ba's (e) same number of a's and b's 3. For each of the following languages, (1) decide whether it's context-free (2) if it is, write a CFG (3) is this CFG ambiguous? justify (draw parse trees). (4) and also draw a PDA (5) if it is recognizable by DPDA, draw the DPDA (a) same number of a's and b's (b) { a^n b^m c^n | m, n >= 0} (c) same number of ab's and ba's 4. Design a TM to accept: (a) ww^R (do you need a # to separate w and w^R?) (b) w#w^R#w (why do you need a # here?) 5. Design a TM to transduce: (a) w => ww^R (b) w => ww (in 4 and 5, w are non-empty bitstrings, i.e., w \in {0,1}+)