Toc Sem Ans-1
Toc Sem Ans-1
DFA cannot use Empty String NFA can use Empty String
3 transition. transition.
DFA rejects the string in case it NFA rejects the string in the
terminates in a state that is event of all branches dying or
7 different from the accepting state. refusing the string.
δ: QxΣ -> Q i.e. next possible δ: QxΣ -> 2^Q i.e. next possible
12. state belongs to Q. state belongs to power set of Q
2.Draw DFA for language which contain set of strings of 0’s and 1’s start with 01.
• ε-closure(q0) = {q0}
• ε-closure(q2) = {q2}
http://lms.cse.saveetha.ac.in/mod/resource/view.php?id=14610
4.Find the language of given deterministic finite automata
5.Draw NFA for language which contain set of strings of 0’s and 1’s ends with 01.
For any regular language L, there exists an integer n, such that for all x ∈ L with |x| ≥ n, there
exists u, v, w ∈ Σ∗, such that x = uvw, and
(1) |uv| ≤ n
(2) |v| ≥ 1
Let State p and state q are equivalent if for all input strings w , ’(p,w) is in accepting states
then ’(q,w) is also in accepting state otherwise states are distinguishable.
11.Give formal definition of Context free grammar and Find the language of
Grammar S → 0S1 | ε
A context free grammar (CFG) is a forma grammar which is used to generate all the
possible patterns of strings in a given formal language. G is a grammar, which consists
of a set of production rules. It is used to generate the strings of a language.
T : a set of terminals (V ∩ T = Ǿ)
S: a start symbol.
S → 0S1 | ε
Solution:
14.When CFG is said to be ambiguous? Check whether the given grammar G is ambiguous
or not.
1. S → aSb | SS
2. S → ε
Ambiguous grammar : Let G= <V,T,P,S> be a grammar is said to be
ambiguous if there is at least a string w in T* have more than one parse
trees ,each with root labelled S and yield w.
1. S → aSb | SS
2. S → ε
Solution : take string aabb, derived from two ways
Here are two parse trees for a single string "aabb", the grammar G is ambiguous.
13. Find the derivation tree for string abb using grammar
S → AB | ε
A → aB
B → Sb
Solution: LMD
RMD
14.When PDA is said to be Deterministic PDA?
15. Which of the functions are performed by the Turing Machine after reading a
symbol?
ID's for TM's are strings of the form α –q– β , where α, β ∈ Γ* and q ∈ Q. ... The string β
represents the non-blank tape contents to the right of the head, including the currently
scanned cell. Adding or deleting a few blank symbols at the beginning of an ID results in an
equivalent ID.
18. Compare Multi-tape Multi-head Turing Machine and Single tape Turing
Machine
A problem whose language is recursive is said to be decidable. Otherwise the problem is said to be
undecidable. Decidable problems have an algorithm that takes as input an instance of the problem
and determines whether the answer to that instance is “yes” or “no”. (eg) of undecidable problems
are (1)Halting problem of the TM.
A recursively enumerable language is a formal language for which there exists a Turing
machine (or other computable function) that will halt and accept when presented with any
string in the language as input but may either halt and reject or loop forever when presented
with a string not in the language.
22. Find whether the lists M = (ab, bab, bbaaa) and N = (a, ba, bab) have a Post
Correspondence Solution?
Let’s explore that the lists M = (ab, bab, bbaaa) and N = (a, ba, bab) include a Post
Correspondence Solution?
x1 x2 x3
M ab bab bbaaa
N a ba bab
Examples
Towers of Hanoi: we can prove that any algorithm that solves this problem must have
a worst-case running time that is at least 2n − 1.
* List all permutations (all possible orderings) of n numbers.
UNIT 1
PART B – 13 MARKS
1. (i) Prove that If a language L is accepted by a NFA then there exists a DFA that
accepts L.
2. Design £-NFA for language L which accept any number of a’s followed by any
number of b’s followed by any number of c’s and Construct the DFA for the obtained
£-NFA.
3. Construct NFA for the following -NFA and check input abb is accepted or not.
2. Construct -NFA for regular expression (a+b)*abb. Construct DFA for the obtained
- NFA.
Part-b
1) Design a Turing Machine to accept L={0n1 n |n>=0} and illustrate the process of input string ‘
0011’ by Turing Machine.
https://drive.google.com/file/d/1aEtlQbKLtKCVaM3Gd6Njbu_mPmkN2UUr/view?usp=sharing
page no:11
https://drive.google.com/file/d/1aEtlQbKLtKCVaM3Gd6Njbu_mPmkN2UUr/view?usp=sharing
page no:5
3) State Halting problem in Turing Machine. Prove that Halting Problem is un-decidable.
https://www.geeksforgeeks.org/halting-problem-in-theory-of-computation/
Part c
1) Explain the basic model of Turing Machine. Construct a Turing Machine to accept Language L={anb
n c n / n>0}.
https://drive.google.com/file/d/1aEtlQbKLtKCVaM3Gd6Njbu_mPmkN2UUr/view?usp=sharing
page no:13
UNIT 5
Part-b
http://www.cs.columbia.edu/~aho/cs3261/Lectures/L16-
Universal_Language.html#:~:text=The%20Universal%20Language%20L&text=Lu%20is%20recursively
%20enumerable,accepted%20by%20that%20Turing%20machine.
https://drive.google.com/file/d/1WiJ5NWcTfxOngIVNTHoy-1r0YlQ_vmzn/view?usp=sharing
page no 3
https://drive.google.com/file/d/1WiJ5NWcTfxOngIVNTHoy-1r0YlQ_vmzn/view?usp=sharing
page no 18 and 30
PART-C
UNIT – I
1. Construct a DFA equivalent to the following NFA whose transition diagram is shown
below
State 0 1
p {p,q} {p}
q {r} {r}
r {s}
*s {s} {s}
http://lms.cse.saveetha.ac.in/mod/folder/view.php?id=14964 topic 4 pdf page number :1..
UNIT –II
Construct -NFA for regular expression (a+b)*baa. Construct a minimized DFA for the
obtained -NFA
(There is a slight changes instead of abb use baa)
UNIT –III
2. 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, )
4) (p,0,X) = (p, )
5) (p, , ) = (p, )
http://lms.cse.saveetha.ac.in/mod/resource/view.php?id=14887
UNIT –IV
Explain the basic model of Turing Machine. Construct a Turing Machine to accept
Language L={anbncn / n>0}.
https://drive.google.com/file/d/1aEtlQbKLtKCVaM3Gd6Njbu_mPmkN2UUr/view?usp=sha
ring
UNIT – V
1. State and prove the properties of recursive and recursive enumerable languages.
http://lms.cse.saveetha.ac.in/mod/folder/view.php?id=26303
(Undecidability pdf ) page no:3