Time Complexity Fall 2006 Costas Busch RPI 1
Time Complexity Fall 2006 Costas Busch - RPI 1
Consider a deterministic Turing Machine which decides a language Fall 2006 Costas Busch - RPI 2
For any string the computation of terminates in a finite amount of transitions Initial state Fall 2006 Accept or Reject Costas Busch - RPI 3
Decision Time = #transitions Initial state Fall 2006 Accept or Reject Costas Busch - RPI 4
Consider now all strings of length = maximum time required to decide any string of length Fall 2006 Costas Busch - RPI 5
TIME STRING LENGTH Max time to accept a string of length Fall 2006 Costas Busch - RPI 6
Time Complexity Class: All Languages decidable by a deterministic Turing Machine in time Fall 2006 Costas Busch - RPI 7
Example: This can be decided in Fall 2006 Costas Busch - RPI time 8
Other example problems in the same class Fall 2006 Costas Busch - RPI 9
Examples in class: Fall 2006 Costas Busch - RPI 10
Examples in class: CYK algorithm Matrix multiplication Fall 2006 Costas Busch - RPI 11
Polynomial time algorithms: constant Represents tractable algorithms: for small we can decide the result fast Fall 2006 Costas Busch - RPI 12
It can be shown: Fall 2006 Costas Busch - RPI 13
The Time Complexity Class Represents: • polynomial time algorithms • “tractable” problems Fall 2006 Costas Busch - RPI 14
Class CYK-algorithm Matrix multiplication Fall 2006 Costas Busch - RPI 15
Exponential time algorithms: Represent intractable algorithms: Some problem instances may take centuries to solve Fall 2006 Costas Busch - RPI 16
Example: the Hamiltonian Path Problem s t Question: is there a Hamiltonian path from s to t? Fall 2006 Costas Busch - RPI 17
s t YES! Fall 2006 Costas Busch - RPI 18
A solution: search exhaustively all paths L = {<G, s, t>: there is a Hamiltonian path in G from s to t} Exponential time Intractable problem Fall 2006 Costas Busch - RPI 19
The clique problem Does there exist a clique of size 5? Fall 2006 Costas Busch - RPI 20
The clique problem Does there exist a clique of size 5? Fall 2006 Costas Busch - RPI 21
Example: The Satisfiability Problem Boolean expressions in Conjunctive Normal Form: clauses Variables Question: is the expression satisfiable? Fall 2006 Costas Busch - RPI 22
Example: Satisfiable: Fall 2006 Costas Busch - RPI 23
Example: Not satisfiable Fall 2006 Costas Busch - RPI 24
exponential Algorithm: search exhaustively all the possible binary values of the variables Fall 2006 Costas Busch - RPI 25
Non-Determinism Language class: A Non-Deterministic Turing Machine decides each string of length in time Fall 2006 Costas Busch - RPI 26
Non-Deterministic Polynomial time algorithms: Fall 2006 Costas Busch - RPI 27
The class Non-Deterministic Polynomial time Fall 2006 Costas Busch - RPI 28
Example: The satisfiability problem Non-Deterministic algorithm: • Guess an assignment of the variables • Check if this is a satisfying assignment Fall 2006 Costas Busch - RPI 29
Time for variables: • Guess an assignment of the variables • Check if this is a satisfying assignment Total time: Fall 2006 Costas Busch - RPI 30
The satisfiability problem is an Fall 2006 Costas Busch - RPI - Problem 31
Observation: Deterministic Polynomial Fall 2006 Non-Deterministic Polynomial Costas Busch - RPI 32
Open Problem: WE DO NOT KNOW THE ANSWER Fall 2006 Costas Busch - RPI 33
Open Problem: Example: Does the Satisfiability problem have a polynomial time deterministic algorithm? WE DO NOT KNOW THE ANSWER Fall 2006 Costas Busch - RPI 34
- Slides: 34