Turing Machines
What do we mean by
Computation?
Turing Machines
The first third of the 20th century resulted in our, finally, obtaining a
useful formal idea of what is meant by computation. We also
obtained a number of results about what functions were "c
Turing Machines
Our most powerful model of a computer is
the Turing Machine. This is an FA with
an infinite tape for storage.
A Turing Machine
A Turing Machine (TM) has three components:
An infinite tape divided into cells. Each cell
contains one symbol.
Theory of Computer Science and Compiler Design
Assignment
Deadline of submission: Before 8th May 2017 by 5:00 p.m.
Q1. Design a Turing machine to perform multiplication for two numbers m and n.
Hint: Start the string with 0n10m1and end with 0mn on the tap
Jaypee Institute of Information and Technology University, Noida (U.P)
Theory of Computation and Compiler Design
Assignment10 and 11
1. Check whether the grammar is suitable for top down parsing? If not Transform it.
Compute first and follow of the modif
Jaypee Institute of Information Technology University, Noida
Theory of Computation and Compiler Design (15B11CI611)
Assignment 7, 8 and 9
1. Let G be the grammar
S 0B 1A,
A 00S1AA,
B 11S0BB
For string 00110101, find
(a) Leftmost derivation, (b) Righ
Jaypee Institute of Information Technology University, Noida
Theory of Computation and Compiler Design (15B11CI611)
Assignment Lex Tool
1) Write a Lex program to accept a string and remove leading, trailing or both leading and trailing
white spaces from
Jaypee Institute of Information and Technology University, Noida (U.P)
Theory of Computation and Compiler Design
(Turing Machine)
Assignment12 and 13
1) Design a Turing machine which changes all as to bs or all bs to a.
2) Deign a Turing machine which re
Jaypee Institute of Information and Technology University, Noida (U.P)
Theory of Computation and Compiler Design
Assignment14 and 15
(SDT, Type Checking, Intermediate Code Generation)
1. Perform the syntaxdirected translation for the following grammar t
Jaypee Institute of Information Technology University, Noida
Theory of Computation and Compiler Design (15B11CI611)
Assignment6
1. You are going to write a lexical analyzer for a toy programming language whose lexical
structure is defined below. You have
Jaypee Institute of Information Technology University, Noida
Theory of Computation and Compiler Design (15B11CI611)
Assignment5
1. A man, a wolf, a goat, and a cabbage are all on one bank of a wide river. The man wishes to
take himself and the three othe
Introduction to Information Retrieval
Information Retrieval Systems
Information
Retrieval
What is information?
What do we mean by retrieval?
What are different types information needs?
Systems
How do computer systems fit into the human
information seeking
Information
Retrieval &
Semantic Web
1
Outline
Syllabus
Book
What is the IR problem?
Indexing
Retrieval
Data Mining
Applications of IR and DM
2
Syllabus
Introduction to Information Retrieval
Boolean Retrieval
Dictionaries and tolerant retrieval
Scoring Te
Deterministic Finite Automata
Controllers (such as elevator, dishwashers,
automatic door) are common examples of
deterministic finite automata (DFAs).
DFAs are an example of machines to describe
a relatively simple form of computation.
Theory of Computati
Theory of Computation
and Compiler Design
(15B11CI611)
Shelly Sachdeva,JIITU
Introduction
Theoretical computer science treats any computational subject for which a
good model can be created.
Research on formal models of computation was initiated in the 19
Theory of Computation
and Compiler Design
(15B11CI611)
Shelly Sachdeva,JIITU
Introduction
Theoretical computer science treats any computational subject for which a
good model can be created.
Research on formal models of computation was initiated in the 19
Regular Expressions
Definition of regular languages
The simplest possible regular languages are
the empty set and languages consisting of a
single string that is either the empty string or
has length one. For example; if = cfw_a,b, the
simplest languages
Compiler Design
Preliminaries Required
Basic knowledge of programming languages.
Basic knowledge of FSA and CFG.
Knowledge of a high programming language for the
programming assignments.
Textbook:
Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman,
Compi
LEXICAL
ANALYSIS
Why a Separate Lexical Analysis Phase?
Programs could be made from characters, and
parse trees would go down to the character
level
Lexical analysis is firewall between program
representation and parsing actions ie
simplicity of design
NFA with Transitions (NFA)
There exist transitions that allow
state changes without consuming
any input symbol.
Similar to NFA, an input is
accepted if there is a path leading
from the start state to a final state
after the whole string is read.
Example
Jaypee Institute of Information Technology University, Noida
Theory of Computation and Compiler Design (15B11CI611)
Assignment4
(Regular Expression)
1) Suppose that for security reasons you require all passwords to have at least one
of the following char
Tool
Lex
LEX:
Tool for constructing lexical analyzers from special purpose
notations based on regular expressions.
Tool widely used to specify lexical analyzers for a variety of
languages.
Lex is a program that takes as its input a text file
containing r
Regular Expressions
DFA, NFA, NFA and RE
DFA, NFA, NFA and RE are all equivalent.
DFA
NFA
NFA
RE
A language that can be described by them is called a
Regular Language
Draw DFA and give RE
Soln
n, t
n, t
Start
q0
n, t, \,
\
q1
q3
q2
\
n
t
\
"
q0



Jaypee Institute of Information Technology University, Noida
Theory of Computation and Compiler Design (15B11CI611)
Assignment1
1) Show a deterministic finite automaton that can be used to look for occurrence of two words at
the same time: daddy and dotd
Jaypee Institute of Information Technology University, Noida
Theory of Computation and Compiler Design (15B11CI611)
Assignment2 and 3
1) Consider the language over cfw_1, 2, 3 in which no string uses more than two of the
symbols from the alphabet. E.g.,
Lab Exercise 10
1. Write a menu driven program showing following operations in a
binary tree
 Insertion
 Deletion
Inorder, preorder and Postorder Traversal
2. Write a menu driven program showing following operations in a
binary Search tree
 Insertion
SINGLESOURCE SHORTEST PATH
PROBLEM
SingleSource Shortest Path Problem  The problem of
finding shortest paths from a source vertex v to all other
vertices in the graph.
DIJKSTRA'S ALGORITHM
Dijkstra's algorithm  is a solution to the singlesource
short
Polynomial Representation
typedef struct nodeType cfw_
int coeff;
int power;
struct nodetype *next;
node;
node *poly;
Coeff
of the
term
Power of Link
x
to
next
node
A=3x14+2x8+1
A
3
14
2
8
1
0
NULL
3 10
10
6
NULL
B=8x143x10+10x6
B
8
14
Sparse Matrix
A
Outline
Graph Adjacency Representation
Topological Sort
Minimum Spanning Tree
Kruskals Algorithm
Prims Algorithm
1
Graph  adjacency representation
Adjacency matrix
A B C D E
B
A 0 0 1 0 1
C
D
B 0 0 0 1 0
C 0 1 0 0 0
D 0 0 1 0 0
E 0 0 1 1 0
A
E
G = (
Graphs
1
Definition of Graphs and
Related Concepts
Representation of Graphs
Graph Traversal
Definition of Graphs
2
A graph is a finite set of nodes with
edges between nodes
Formally, a graph G is a structure (V,E)
consisting of
a finite set V called the