Time%20Complexity - PowerPoint PPT Presentation

About This Presentation
Title:

Time%20Complexity

Description:

Compare the and. Time needed: Total time: 4. For string of ... Compare the two tapes. 24. 25. In a similar way we define the class. for any time function: ... – PowerPoint PPT presentation

Number of Views:15
Avg rating:3.0/5.0
Slides: 34
Provided by: costas
Learn more at: http://www.cs.rpi.edu
Category:

less

Transcript and Presenter's Notes

Title: Time%20Complexity


1
Time Complexity
  • We use a multitape Turing machine
  • We count the number of steps until
  • a string is accepted
  • We use the O(k) notation

2
Example
Algorithm to accept a string
  • Use a two-tape Turing machine
  • Copy the on the second tape
  • Compare the and

3
Time needed
  • Copy the on the second tape
  • Compare the and

Total time
4
For string of length time needed for acceptance
5
Language class
A Deterministic Turing Machine accepts each
string of length in time
6
(No Transcript)
7
In a similar way we define the class
for any time function
Examples
8
Example The membership problem
for context free languages
(CYK - algorithm)
Polynomial time
9
Theorem
10
Polynomial time algorithms
Represent tractable algorithms
For small we can compute the result fast
11
The class
for all
  • Polynomial time
  • All tractable problems

12
CYK-algorithm
13
Exponential time algorithms
Represent intractable algorithms
Some problem instances may take centuries to solve
14
Example the Hamiltonian Problem
s
t
Question is there a Hamiltonian path
from s to t?
15
s
t
YES!
16
A solution search exhaustively all paths
L ltG,s,tgt there is a Hamiltonian path
in G from s to t
Exponential time
Intractable problem
17
Example The Satisfiability Problem
Boolean expressions in Conjunctive Normal Form
Variables
Question is expression satisfiable?
18
Example
Satisfiable
19
Example
Not satisfiable
20
For variables
exponential
Algorithm search exhaustively all the
possible binary values of the variables
21
Non-Determinism
Language class
A Non-Deterministic Turing Machine accepts each
string of length in time
22
Example
Non-Deterministic Algorithm to accept a string
  • Use a two-tape Turing machine
  • Guess the middle of the string
  • and copy on the second tape
  • Compare the two tapes

23
Time needed
  • Use a two-tape Turing machine
  • Guess the middle of the string
  • and copy on the second tape
  • Compare the two tapes

Total time
24
(No Transcript)
25
In a similar way we define the class
for any time function
Examples
26
Non-Deterministic Polynomial time algorithms
27
The class
for all
Non-Deterministic Polynomial time
28
The satisfiability problem
Example
Non-Deterministic algorithm
  • Guess an assignment of the variables
  • Check if this is a satisfying assignment

29
Time for variables
  • Guess an assignment of the variables
  • Check if this is a satisfying assignment

Total time
30
The satisfiability problem is an - Problem
31
Observation
Deterministic Polynomial
Non-Deterministic Polynomial
32
Open Problem
WE DO NOT KNOW THE ANSWER
33
Open Problem
Example Does the Satisfiability problem
have a polynomial time
deterministic algorithm?
WE DO NOT KNOW THE ANSWER
Write a Comment
User Comments (0)
About PowerShow.com