Assignment TOC 2023-24 EVEN
Assignment TOC 2023-24 EVEN
S.
WRITTEN ASSIGNMENT QUESTIONS Marks BL SL
No
UNIT - I (AUTOMATA AND REGULAR EXPRESSIONS)
1. Let M =(Q,,6,qo,F) be a DFA and let h be a state of Al called its "home".A
synchronizing sequence for M and h is a string s C E* where oi(q, s) = h for
every q e Q. (Here we have extended d to strings, so that 6(q, S) equals the state
where M ends up when M starts at state q and reads input s.) Say that M is 20 K4 A1
syncbronizable if it has a synchronizing sequence for some state h. Prove that,
if M is a k-state synchronizable DFA, then it has a synchronizing sequence of
length at most k3. Can you improve upon this bound?
2. A finite state transducer (FST) is a type of deterministic finite automaton whose 20 K4 A2
output is a string and not just accept or reject. The following are state diagrams
of finite state transducers T1 and T2 .
Each transition of an FST is labeled with two symbols, one designating the
input symbol for that transition and the other designating the output symbol.
The two symbols are written with a slash, /, separating them. In T1, the
transition from q1 to q2 has input symbol 2 and output symbol 1. Some
transitions may have multiple input-output pairs, such as the transition in T1
from q1 to itself. When an FST computes on an input string w, it takes the input
symbols WV. w, one by one and, starting at the start state, follows the
transitions by matching the input labels with the sequence of symbols wi ... w,
= w. Every time it goes along a transition, it outputs the corresponding output
symbol. For example, on input 2212011, machine T1 enters the sequence of
states q1, q2, q2, q2, q2, q1, q1, q1 and produces output 1111000. On input
abbb, T2 outputs 1011. Give the sequence of states entered and the output
produced in each of the following parts.
a. T1 on input 01l e. T2 on input b
b. T1 on input 211 f. T2 on input bbab
c. T1 on input 121 g. T2 on input bbbbbb
d. T1 on input 0202 h. T2 on input €
3. Give state diagrams of DFAs recognizing the following languages. In all parts
the alphabet is {0,1 }
a. {wI w begins with a 1 and ends with a }
b. {wl w contains at least three 1s}
c. {wl w contains the substring 0101, i.e., w = xOiOiy for some x
and y}
d. {w I w has length at least 3 and its third symbol is a 0}
e. {wl wi starts with 0 and has odd length, or starts with 1 and
has even length}
f {wI wi doesn't contain the substring 1101
20 K3 B1
g. {uw the length of w is at most 5}
h. {wl w is any string except 11 and 1111
i. {wj every odd position of w is a ll
j. {w I w contains at least two Os and at most one 11
k. {s, 0}
1. {w I w contains an even number of Os, or contains exactly two
ls}
m. The empty set
n. All strings except the empty string
20 K2 C1
(ii) Let
B = {w € ∑*3 │ the bottom row of w is the sum of the top two rows}.
For example,
20 K3 B3
ASSIGNMENT - II
Academic Year 2023 - 2024
Degree / Program B.E / CSE(CS)
& Semester (Even)
Course Code & Course
CS3452 & Theory of Computation Year / Sem. II / IV
Name
Name of the Faculty &
Ms.K.Sudha, AP/CSE(CS) Regulation 2021
Department
Email [email protected] Contact No 6380118908
S.
WRITTEN ASSIGNMENT QUESTIONS Marks BL SL
No
UNIT – III (CONTEXT FREE GRAMMAR AND PUSH DOWN AUTOMATA)
1. Show using mathematical induction that every string produced by the
context-free grammar with productions
20 K4 A3
S →a | aS | bSS | SSb | SbS
has more a’s than b’s.
2. Design a PDA to accept each of the following language. You may accept either
by final state or by empty stack, whichever is more convenient.
a) {0n1n|n>=1} 20 K4 A4
b The set of all strings of 0`s and 1`s such that no prefix has more 1`s than 1`s
c The set of all strings of 0`s and 1`s with an equal number of 0`s and 1`s
3. Prove that the CFG with productions S → aSbS | aSbS | Δ generates the
20 K3 B4
language L = {x ∈ {a, b}∗ | na(x) = nb(x)}.
4. Convert the PDA P =({p,q},{0,1},{X,Z0},δ,q,Z0) to a CFG, if δ is given by:
1. δ(q,1, Z0)={(q,XZ0)}
2. δ(q,1, X)={(q,XX)}
3. δ(q,0, X)={(p,X)} 20 K3 B5
4. δ(q, ε, X)={(q, ε)}
5. δ(p,1, X)={(p, ε)}
6. δ(p,0, Z0)={(q,Z0)}
5. Give deterministic pushdown automata to accept the following languages:
1. {0n1m| n<=m}
20 K3 B6
2. {0n1m| n>=m}
3. {0n1m0n| n and m are arbitary}
6. Show that every regular language is a context free language Hint: Construct a 20 K4 C2
CFG by induction on the number of operators in the regular expression.
7. Find context-free grammars generating each of the languages below.
a. {aibj | i ≤ j}
b. {aibj | i < j}
c. {aibj | j = 2i} 20 K4 C3
d. {aibj | i ≤ j ≤ 2i}
e. {aibj | j ≤ 2i}
f. {aibj | j < 2i}
UNIT - IV (NORMAL FORMS AND TURING MACHINES)
1. Reduce the following grammars to Greibach normal form:
(a) S SS, S 0S1 | 01
20 K4 A3
(b) S AB, A BSB, A BB, B aAb, B a, A b
(c) S A0, A 0B, B A0, B 1
2. Below is a transition table for a TM with input alphabet {a, b}.
20 K4 A5
20 K4 A4