Download presentation
Presentation is loading. Please wait.
1
Fall 2004COMP 3351 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
Fall 2004COMP 3352 Example: Algorithm to accept a string : Use a two-tape Turing machine Copy the on the second tape Compare the and
3
Fall 2004COMP 3353 Copy the on the second tape Compare the and Time needed: Total time:
4
Fall 2004COMP 3354 For string of length time needed for acceptance:
5
Fall 2004COMP 3355 Language class: A Deterministic Turing Machine accepts each string of length in time
6
Fall 2004COMP 3356
7
Fall 2004COMP 3357 In a similar way we define the class for any time function: Examples:
8
Fall 2004COMP 3358 Example: The membership problem for context free languages (CYK - algorithm) Polynomial time
9
Fall 2004COMP 3359 Theorem:
10
Fall 2004COMP 33510 Polynomial time algorithms: Represent tractable algorithms: For small we can compute the result fast
11
Fall 2004COMP 33511 for all The class All tractable problems Polynomial time
12
Fall 2004COMP 33512 CYK-algorithm
13
Fall 2004COMP 33513 Exponential time algorithms: Represent intractable algorithms: Some problem instances may take centuries to solve
14
Fall 2004COMP 33514 Example: the Hamiltonian Problem Question: is there a Hamiltonian path from s to t? s t
15
Fall 2004COMP 33515 s t YES!
16
Fall 2004COMP 33516 Exponential time Intractable problem A solution: search exhaustively all paths L = { : there is a Hamiltonian path in G from s to t}
17
Fall 2004COMP 33517 Example: The Satisfiability Problem Boolean expressions in Conjunctive Normal Form: Variables Question: is expression satisfiable?
18
Fall 2004COMP 33518 Satisfiable: Example:
19
Fall 2004COMP 33519 Not satisfiable Example:
20
Fall 2004COMP 33520 For variables: Algorithm: search exhaustively all the possible binary values of the variables exponential
21
Fall 2004COMP 33521 Non-Determinism Language class: A Non-Deterministic Turing Machine accepts each string of length in time
22
Fall 2004COMP 33522 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
Fall 2004COMP 33523 Time needed: Total time: Use a two-tape Turing machine Guess the middle of the string and copy on the second tape Compare the two tapes
24
Fall 2004COMP 33524
25
Fall 2004COMP 33525 In a similar way we define the class for any time function: Examples:
26
Fall 2004COMP 33526 Non-Deterministic Polynomial time algorithms:
27
Fall 2004COMP 33527 for all The class Non-Deterministic Polynomial time
28
Fall 2004COMP 33528 Example: The satisfiability problem Non-Deterministic algorithm: Guess an assignment of the variables Check if this is a satisfying assignment
29
Fall 2004COMP 33529 Time for variables: Total time: Guess an assignment of the variables Check if this is a satisfying assignment
30
Fall 2004COMP 33530 The satisfiability problem is an - Problem
31
Fall 2004COMP 33531 Observation: Deterministic Polynomial Non-Deterministic Polynomial
32
Fall 2004COMP 33532 Open Problem: WE DO NOT KNOW THE ANSWER
33
Fall 2004COMP 33533 Example: Does the Satisfiability problem have a polynomial time deterministic algorithm? WE DO NOT KNOW THE ANSWER Open Problem:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.