Professional Documents
Culture Documents
Computational Complexity
Summer 2014
Mihalis Yannakakis
Lecture 1
Course Information
Lectures:
Monday, Wednesday 2:40-3:55
535 Mudd
Web site:
Courseworks
TA: Dimitris Paparas
Course Work
Homeworks, Final
Policies
Late Homework: 10% penalty per late day
Lowest hw does not count in grade
Collaboration policy
Grading: Homeworks 60%, Final 40%
Textbook
Required:
Computational Complexity, by C. Papadimitriou
Other:
-Computational Complexity: A Modern Approach, by S. Arora,
B. Barak
-Introduction to the Theory of Computation, by M. Sipser
-Introduction to Automata Theory, Languages and
Computation, by Hopcroft, Motwani, Ullman
-Computers and Intractability: A Guide to the Theory of NPcompleteness, by Garey, Johnson
Problems
Problem: What needs to be computed
Input
Output
Algorithms, Models
Model of Computation
eg. sequential (von Neumann) computer
parallel computer
quantum computer
Boolean circuit
..
Laws of Computation
Graph Reachability
Input: Directed Graph G=(N,E), nodes s, t
Question: Is there a path in G from s to t?
i.e. Output= Yes (if there is a path) or No (if
there is no path)
Decision problem: output = Yes/No
Graph may be given by its adjacency matrix A or
by adjacency lists: a list Adj[u] for each u in N
that lists all nodes v to which u has an edge
Example
1
4
5
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
1
1
0
3
Graph
Adjacency Matrix
A[i,j]=1 iff ij
Graph Search
for each vN-{s} do {mark[v]=0}
mark[s]=1 ;
Q = {s}
while Q do
{ u= select and delete a node from Q
for each v N do
if (A[u,v]=1 and mark[v]=0) then
{mark[v]=1; Q=Q{v} }
}
If mark[t]=1 then print Yes else print No
If Q implemented as a queue (i.e. we delete from front, insert
into back), then Breadth-First-Search
Time Complexity
For every input graph with n nodes, the time complexity is
proportional to n: Time=O(n)
Some important points to note:
Complexity is expressed as a function of a parameter n
measuring the size of the input (here the number of
nodes)
Worst-case complexity: maximum over all inputs of size n
Expressed complexity in terms of its rate of growth:
asymptotic notation O(.) suppresses constant factors
Example:
cg(n)
f(n)
5n O(n 2 )
n0
Asymptotic Notations:
Theta, Big-Oh, Omega
Omega:
f(n)
Example:
5n 2 (n)
c g(n)
n0
Asymptotic Notations:
Theta, Big-Oh, Omega
Theta:
c2 g (n)
f(n)
c1 g (n)
n0
Asymptotic Notations:
little-oh, little-omega
little-oh:
5n o(n 2 ),
5n 2 (n)
f (n) ( g (n))
f ( n) / g ( n)
f (n) ( g (n))
c f ( n) / g ( n)
f (n) ( g (n))
c1 f (n) / g (n) c 2
f (n) O( g (n))
f ( n) / g ( n) c
f (n) o( g (n))
f ( n) / g ( n) 0
Examples
For every polynomial p(n) of degree d with a positive
leading term, p(n)=(nd). For example, 4n-3n+7=(n)
Every constant is O(1), for example 1000=O(1)
logan = (logcn) for any two constant bases a, c,
For example log10n = (log2n)
Every constant power of logn is little-oh of every
10
constant root of n, for example (log n) o( 5 n )
Every power of n is little-oh of every exponential function
10
n
n
o
(1.1
)
of n, for example
n n n log n n n
2
(polynomial)
2 3 n !
n
(exponential)