![Page 1: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/1.jpg)
Fall 2006 Costas Busch - RPI 1
Time Complexity
![Page 2: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/2.jpg)
Fall 2006 Costas Busch - RPI 2
ML
Consider a deterministic Turing Machinewhich decides a language
![Page 3: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/3.jpg)
Fall 2006 Costas Busch - RPI 3
For any string the computation ofterminates in a finite amount of transitions
w M
Acceptor Reject w
Initialstate
![Page 4: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/4.jpg)
Fall 2006 Costas Busch - RPI 4
Acceptor Reject w
Decision Time = #transitions
Initialstate
![Page 5: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/5.jpg)
Fall 2006 Costas Busch - RPI 5
Consider now all strings of lengthn
)(nTM = maximum time required to decide any string of length n
![Page 6: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/6.jpg)
Fall 2006 Costas Busch - RPI 6
)(nTM
Max time to accept a string of length n
1 2 3 4 n STRING LENGTH
TIM
E
![Page 7: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/7.jpg)
Fall 2006 Costas Busch - RPI 7
Time Complexity Class: ))(( nTTIME
All Languages decidable by a deterministic Turing Machinein time
1L 2L
3L
))(( nTO
![Page 8: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/8.jpg)
Fall 2006 Costas Busch - RPI 8
Example: }0:{1 nbaL n
This can be decided in time)(nO
)(nTIME
}0:{1 nbaL n
![Page 9: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/9.jpg)
Fall 2006 Costas Busch - RPI 9
)(nTIME
}0:{1 nbaL n
}0,:{ knabaabn
}even is :{ nbn
Other example problems in the same class
}3:{ knbn
![Page 10: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/10.jpg)
Fall 2006 Costas Busch - RPI 10
)( 2nTIME
}0:{ nba nn
Examples in class:
}},{:{ bawwwR
}},{:{ bawww
![Page 11: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/11.jpg)
Fall 2006 Costas Busch - RPI 11
)( 3nTIMEExamples in class:
} grammar free-context
by generated is :,{2
G
wwGL
} and
matrices :,,{
321
3213
MMM
nnMMML
CYK algorithm
Matrix multiplication
![Page 12: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/12.jpg)
Fall 2006 Costas Busch - RPI 12
Polynomial time algorithms: )( knTIME
Represents tractable algorithms:
for small we can decidethe result fast
k
constant 0k
![Page 13: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/13.jpg)
Fall 2006 Costas Busch - RPI 13
)( knTIME
)( 1knTIME
)()( 1 kk nTIMEnTIME It can be shown:
![Page 14: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/14.jpg)
Fall 2006 Costas Busch - RPI 14
0
)(
k
knTIMEP
The Time Complexity Class P
•“tractable” problems
•polynomial time algorithms
Represents:
![Page 15: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/15.jpg)
Fall 2006 Costas Busch - RPI 15
P
CYK-algorithm
}{ nnba }{ww
Class
Matrix multiplication
}{ ban
![Page 16: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/16.jpg)
Fall 2006 Costas Busch - RPI 16
Exponential time algorithms: )2(knTIME
Represent intractable algorithms:
Some problem instancesmay take centuries to solve
![Page 17: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/17.jpg)
Fall 2006 Costas Busch - RPI 17
Example: the Hamiltonian Path Problem
Question: is there a Hamiltonian path from s to t?
s t
![Page 18: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/18.jpg)
Fall 2006 Costas Busch - RPI 18
s t
YES!
![Page 19: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/19.jpg)
Fall 2006 Costas Busch - RPI 19
)2()!(knTIMEnTIMEL
Exponential time
Intractable problem
A solution: search exhaustively all paths
L = {<G,s,t>: there is a Hamiltonian path in G from s to t}
![Page 20: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/20.jpg)
Fall 2006 Costas Busch - RPI 20
The clique problem
Does there exist a clique of size 5?
![Page 21: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/21.jpg)
Fall 2006 Costas Busch - RPI 21
The clique problem
Does there exist a clique of size 5?
![Page 22: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/22.jpg)
Fall 2006 Costas Busch - RPI 22
Example: The Satisfiability Problem
Boolean expressions inConjunctive Normal Form:
ktttt 321
pi xxxxt 321
Variables
Question: is the expression satisfiable?
clauses
![Page 23: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/23.jpg)
Fall 2006 Costas Busch - RPI 23
)()( 3121 xxxx
Satisfiable: 1,1,0 321 xxx
1)()( 3121 xxxx
Example:
![Page 24: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/24.jpg)
Fall 2006 Costas Busch - RPI 24
2121 )( xxxx
Not satisfiable
Example:
![Page 25: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/25.jpg)
Fall 2006 Costas Busch - RPI 25
e}satisfiabl is expression :{ wwL
)2(knTIMEL
Algorithm: search exhaustively all the possible binary values of the variables
exponential
![Page 26: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/26.jpg)
Fall 2006 Costas Busch - RPI 26
Non-Determinism
Language class: ))(( nTNTIME
A Non-Deterministic Turing Machine decides each string of length in time
1L
2L3L
))(( nTO
n
![Page 27: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/27.jpg)
Fall 2006 Costas Busch - RPI 27
Non-Deterministic Polynomial time algorithms:
)( knNTIMEL
![Page 28: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/28.jpg)
Fall 2006 Costas Busch - RPI 28
0
)(
k
knNTIMENP
The class NP
Non-Deterministic Polynomial time
![Page 29: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/29.jpg)
Fall 2006 Costas Busch - RPI 29
Example: The satisfiability problem
Non-Deterministic algorithm:
•Guess an assignment of the variables
e}satisfiabl is expression :{ wwL
•Check if this is a satisfying assignment
![Page 30: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/30.jpg)
Fall 2006 Costas Busch - RPI 30
Time for variables: n
)(nO
e}satisfiabl is expression :{ wwL
Total time:
•Guess an assignment of the variables
•Check if this is a satisfying assignment )(nO
)(nO
![Page 31: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/31.jpg)
Fall 2006 Costas Busch - RPI 31
e}satisfiabl is expression :{ wwL
NPL
The satisfiability problem is an - ProblemNP
![Page 32: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/32.jpg)
Fall 2006 Costas Busch - RPI 32
Observation:
NPP
DeterministicPolynomial
Non-DeterministicPolynomial
![Page 33: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/33.jpg)
Fall 2006 Costas Busch - RPI 33
Open Problem: ?NPP
WE DO NOT KNOW THE ANSWER
![Page 34: Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language](https://reader034.vdocuments.mx/reader034/viewer/2022051515/55176e0a5503463e368b4b4f/html5/thumbnails/34.jpg)
Fall 2006 Costas Busch - RPI 34
Example: Does the Satisfiability problem have a polynomial time deterministic algorithm?
WE DO NOT KNOW THE ANSWER
Open Problem: ?NPP