1 time complexity we use a multitape turing machine we count the number of steps until a string is...
DESCRIPTION
3 Copy the on the second tape Compare the and Time needed: Total time:TRANSCRIPT
![Page 1: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/1.jpg)
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
![Page 2: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/2.jpg)
2
Example: }0:{ nbaL nn
Algorithm to accept a string :w
•Use a two-tape Turing machine
•Copy the on the second tape
•Compare the and
a
a b
![Page 3: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/3.jpg)
3
|)(|wO•Copy the on the second tape
•Compare the and
a
a b
Time needed:
|)(|wO
Total time: |)(|wO
}0:{ nbaL nn
![Page 4: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/4.jpg)
4
For string of length
time needed for acceptance:
}0:{ nbaL nn
n
)(nO
![Page 5: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/5.jpg)
5
Language class: )(nDTIME
A Deterministic Turing Machine accepts each string of length in time
)(nDTIME
1L2L 3L
)(nOn
![Page 6: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/6.jpg)
6
)(nDTIME
}0:{ nba nn}{ww
![Page 7: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/7.jpg)
7
In a similar way we define the class
))(( nTDTIME
)(nTfor any time function:
Examples: ),...(),( 32 nDTIMEnDTIME
![Page 8: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/8.jpg)
8
Example: The membership problem for context free languages
}grammar by generated is :{ GwwL
)( 3nDTIMEL (CYK - algorithm)
Polynomial time
![Page 9: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/9.jpg)
9
Theorem:
)( knDTIME
)( 1knDTIME
1( ) ( )k kDTIME n DTIME n
![Page 10: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/10.jpg)
10
Polynomial time algorithms: )( knDTIME
Represent tractable algorithms:For small we can compute theresult fast
k
![Page 11: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/11.jpg)
11
)( knDTIMEP for all k
The class P
•All tractable problems
•Polynomial time
![Page 12: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/12.jpg)
12
PCYK-algorithm
}{ nnba
}{ww
![Page 13: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/13.jpg)
13
Exponential time algorithms: )2( nDTIME
Represent intractable algorithms:Some problem instancesmay take centuries to solve
![Page 14: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/14.jpg)
14
Example: the Hamiltonian Problem
Question: is there a Hamiltonian path from s to t?
s t
![Page 15: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/15.jpg)
15
s t
YES!
![Page 16: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/16.jpg)
16
)2()!( nDTIMEnDTIMEL
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 17: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/17.jpg)
17
Example: The Satisfiability Problem
Boolean expressions inConjunctive Normal Form:
ktttt 321
pi xxxxt 321Variables
Question: is expression satisfiable?
![Page 18: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/18.jpg)
18
)()( 3121 xxxx
Satisfiable: 1,1,0 321 xxx
1)()( 3121 xxxx
Example:
![Page 19: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/19.jpg)
19
2121 )( xxxx
Not satisfiable
Example:
![Page 20: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/20.jpg)
20
e}satisfiabl is expression :{ wwL
)2( nDTIMELFor variables: n
Algorithm: search exhaustively all the possible binary values of the variables
exponential
![Page 21: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/21.jpg)
21
Non-DeterminismLanguage class: )(nNTIME
A Non-Deterministic Turing Machine accepts each string of length in time
)(nNTIME
1L2L 3L
)(nOn
![Page 22: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/22.jpg)
22
Example: }{wwL
Non-Deterministic Algorithmto accept a string :ww
•Use a two-tape Turing machine
•Guess the middle of the string and copy on the second tape
•Compare the two tapes
w
![Page 23: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/23.jpg)
23
|)(|wO
Time needed:
|)(|wO
Total time: |)(|wO
}{wwL
•Use a two-tape Turing machine
•Guess the middle of the string and copy on the second tape
•Compare the two tapes
w
![Page 24: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/24.jpg)
24
)(nNTIME
}{wwL
![Page 25: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/25.jpg)
25
In a similar way we define the class
))(( nTNTIME
)(nTfor any time function:
Examples: ),...(),( 32 nNTIMEnNTIME
![Page 26: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/26.jpg)
26
Non-Deterministic Polynomial time algorithms:
)( knNTIMEL
![Page 27: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/27.jpg)
27
)( knNTIMENP for all k
The class NP
Non-Deterministic Polynomial time
![Page 28: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/28.jpg)
28
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 29: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/29.jpg)
29
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 30: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/30.jpg)
30
e}satisfiabl is expression :{ wwL
NPL
The satisfiability problem is an - ProblemNP
![Page 31: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/31.jpg)
31
Observation:
NPP
DeterministicPolynomial
Non-DeterministicPolynomial
![Page 32: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/32.jpg)
32
Open Problem: ?NPP
WE DO NOT KNOW THE ANSWER
![Page 33: 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](https://reader033.vdocuments.site/reader033/viewer/2022051104/5a4d1b627f8b9ab0599add38/html5/thumbnails/33.jpg)
33
Example: Does the Satisfiability problem have a polynomial time deterministic algorithm?
WE DO NOT KNOW THE ANSWER
Open Problem: ?NPP