GATE Computer ScienceVery hardGATE CS (PYQ pattern)
A CNF grammar has productions S → AB | BC; A → BA | a; B → CC | b; C → AB | a. The CYK algorithm is run on the string baaba, filling a triangular table with the set of variables deriving each substring. What is the total number of variables (counted over all 15 cells) that appear in the table?
- A. 25
- B. 23
- C. 21
- D. 15
Correct answer: B. 23
Filling cell by cell (substrings of length 1, then 2, …, 5) gives 23 variable entries in total; S appears in the top cell: True.
More Theory of Computation questions
- For the CNF grammar S → AB | BC; A → BA | a; B → CC | b; C → AB | a, the CYK table for the string aabab has a top cell (the whole string)…
- A TM (blank B, start q0 on the leftmost cell, halting state qa) has rules: δ(q0,1) = (q0,1,R); δ(q0,0) = (q1,1,R); δ(q1,1) = (q1,1,R)…
- For the TM with rules δ(q0,1) = (q0,1,R); δ(q0,0) = (q1,1,R); δ(q1,1) = (q1,1,R); δ(q1,B) = (q2,B,L); δ(q2,1) = (qa,B,R) (start q0 on the…
- A TM with rules δ(q0,a) = (q1,X,R); δ(q0,Y) = (q3,Y,R); δ(q1,a) = (q1,a,R); δ(q1,Y) = (q1,Y,R); δ(q1,b) = (q2,Y,L); δ(q2,a) = (q2,a,L)…
- A single-tape TM (blank B, start q0 on the leftmost cell, accepting state qa) has rules: δ(q0,0) = (q1,B,R); δ(q0,1) = (q4,B,R); δ(q0,B) =…
- For the palindrome-checking TM with rules δ(q0,0) = (q1,B,R); δ(q0,1) = (q4,B,R); δ(q0,B) = (qa,B,R); δ(q1,0) = (q1,0,R); δ(q1,1) =…