SlideShare une entreprise Scribd logo
1  sur  45
Formal Languages
Time Complexity
Hinrich Schütze
IMS, Uni Stuttgart, WS 2006/07
Slides based on RPI CSCI 2400
Thanks to Costas Busch
M
L
Consider a deterministic Turing Machine
which decides a language
For any string the computation of
terminates in a finite amount of transitions
w M

Accept
or Reject w
Initial
state

Accept
or Reject w
Decision Time = #transitions
Initial
state
Consider now all strings of length n
)
(n
TM
= maximum time required to decide
any string of length n

)
(n
TM
Max time to accept a string of length n
1 2 3 4 n 
STRING LENGTH
TIME
Time Complexity Class: ))
(
( n
T
TIME
All Languages decidable by a
deterministic Turing Machine
in time
1
L 2
L
3
L
))
(
( n
T
O
Example: }
0
:
{
1 
 n
b
a
L n
Example: }
0
:
{
1 
 n
b
a
L n
This can be decided in time
)
(n
O
)
(n
TIME
}
0
:
{
1 
 n
b
a
L n
)
(n
TIME
}
0
:
{
1 
 n
b
a
L n
}
0
,
:
{ 
k
n
aba
abn
}
even
is
:
{ n
bn
Other example problems in the same class
}
3
:
{ k
n
bn

)
( 2
n
TIME
}
0
:
{ 
n
b
a n
n
Examples in class:
}}
,
{
:
{ b
a
w
ww R

}}
,
{
:
{ b
a
w
ww 
)
( 3
n
TIME
Examples in class:
}
grammar
free
-
context
by
generated
is
:
,
{
2
G
w
w
G
L 
}
and
matrices
:
,
,
{
3
2
1
3
2
1
3
M
M
M
n
n
M
M
M
L




CYK algorithm
Matrix multiplication
Polynomial time algorithms: )
( k
n
TIME
Represents tractable algorithms:
for small we can decide
the result fast
k
constant 0

k
)
( k
n
TIME
)
( 1

k
n
TIME
)
(
)
( 1 k
k
n
TIME
n
TIME 

It can be shown:

0
)
(


k
k
n
TIME
P
The Time Complexity Class P
•“tractable” problems
•polynomial time algorithms
Represents:
P
CYK-algorithm
}
{ n
n
b
a }
{ww
Class
Matrix multiplication
}
{ b
an
Exponential time algorithms: )
2
(
k
n
TIME
Represent intractable algorithms:
Some problem instances
may take centuries to solve
Example: the Hamiltonian Path Problem
Question: is there a Hamiltonian path
from s to t?
s t
s t
YES!
Time?
)
2
(
)
!
(
k
n
TIME
n
TIME
L 

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}
The clique problem
Does there exist a clique of size 5?
The clique problem
Does there exist a clique of size 5?
Example: The Satisfiability Problem
Boolean expressions in
Conjunctive Normal Form:
k
t
t
t
t 


 
3
2
1
p
i x
x
x
x
t 



 
3
2
1
Variables
Question: is the expression satisfiable?
clauses
)
(
)
( 3
1
2
1 x
x
x
x 


Satisfiable?
Example:
)
(
)
( 3
1
2
1 x
x
x
x 


Satisfiable: 1
,
1
,
0 3
2
1 

 x
x
x
1
)
(
)
( 3
1
2
1 


 x
x
x
x
Example:
2
1
2
1 )
( x
x
x
x 


Not satisfiable
Example:
e}
satisfiabl
is
expression
:
{ w
w
L 
)
2
(
k
n
TIME
L 
Algorithm?
exponential
e}
satisfiabl
is
expression
:
{ w
w
L 
)
2
(
k
n
TIME
L 
Algorithm:
search exhaustively all the possible
binary values of the variables
exponential
Non-Determinism
Language class: ))
(
( n
T
NTIME
A Non-Deterministic Turing Machine
decides each string of length
in time
1
L
2
L
3
L
))
(
( n
T
O
n
Non-Deterministic Polynomial time algorithms:
)
( k
n
NTIME
L

0
)
(


k
k
n
NTIME
NP
The class NP
Non-Deterministic Polynomial time
Example: The satisfiability problem
Non-Deterministic algorithm?
e}
satisfiabl
is
expression
:
{ w
w
L 
Example: The satisfiability problem
Non-Deterministic algorithm:
•Guess an assignment of the variables
e}
satisfiabl
is
expression
:
{ w
w
L 
•Check if this is a satisfying assignment
Time for variables:
n
)
(n
O
e}
satisfiabl
is
expression
:
{ w
w
L 
Total time:
•Guess an assignment of the variables
•Check if this is a satisfying assignment )
(n
O
)
(n
O
e}
satisfiabl
is
expression
:
{ w
w
L 
NP
L
The satisfiability problem is an - Problem
NP
Observation:
NP
P 
Deterministic
Polynomial
Non-Deterministic
Polynomial
Open Problem: ?
NP
P 
WE DO NOT KNOW THE ANSWER
Example: Does the Satisfiability problem
have a polynomial time
deterministic algorithm?
WE DO NOT KNOW THE ANSWER
Open Problem: ?
NP
P 
NP-Completeness
A problem is NP-complete if:
•It is in NP
•Every NP problem is reduced to it
(in polynomial time)
Observation:
If we can solve any NP-complete problem
in Deterministic Polynomial Time (P time)
then we know:
NP
P 
Observation:
If we prove that
we cannot solve an NP-complete problem
in Deterministic Polynomial Time (P time)
then we know:
NP
P 
Cook’s Theorem:
The satisfiability problem is NP-complete
Proof:
Convert a Non-Deterministic Turing Machine
to a Boolean expression
in conjunctive normal form
Other NP-Complete Problems:
•The Traveling Salesperson Problem
•Vertex cover
•Hamiltonian Path
All the above are reduced
to the satisfiability problem
Observations:
It is unlikely that NP-complete
problems are in P
The NP-complete problems have
exponential time algorithms
Approximations of these problems
are in P

Contenu connexe

Similaire à timecomplexity.ppt

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small ...
Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small ...Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small ...
Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small ...Hector Zenil
 
Fractal dimension versus Computational Complexity
Fractal dimension versus Computational ComplexityFractal dimension versus Computational Complexity
Fractal dimension versus Computational ComplexityHector Zenil
 
Applied Calculus Chapter 2 vector valued function
Applied Calculus Chapter  2 vector valued functionApplied Calculus Chapter  2 vector valued function
Applied Calculus Chapter 2 vector valued functionJ C
 
Chapter2vectorvaluedfunction 150105020944-conversion-gate02
Chapter2vectorvaluedfunction 150105020944-conversion-gate02Chapter2vectorvaluedfunction 150105020944-conversion-gate02
Chapter2vectorvaluedfunction 150105020944-conversion-gate02Cleophas Rwemera
 
Computational Complexity: Complexity Classes
Computational Complexity: Complexity ClassesComputational Complexity: Complexity Classes
Computational Complexity: Complexity ClassesAntonis Antonopoulos
 
Sampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxSampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxHamzaJaved306957
 
Winter 8 TM.pptx
Winter 8 TM.pptxWinter 8 TM.pptx
Winter 8 TM.pptxHarisPrince
 
Ss important questions
Ss important questionsSs important questions
Ss important questionsSowji Laddu
 
Ch4 (1)_fourier series, fourier transform
Ch4 (1)_fourier series, fourier transformCh4 (1)_fourier series, fourier transform
Ch4 (1)_fourier series, fourier transformShalabhMishra10
 
Univariate Financial Time Series Analysis
Univariate Financial Time Series AnalysisUnivariate Financial Time Series Analysis
Univariate Financial Time Series AnalysisAnissa ATMANI
 
Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10) Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10) Larry Guo
 
Signals and Systems.pptx
Signals and Systems.pptxSignals and Systems.pptx
Signals and Systems.pptxVairaPrakash2
 
Signals and Systems.pptx
Signals and Systems.pptxSignals and Systems.pptx
Signals and Systems.pptxVairaPrakash2
 
Note and assignment mis3 5.3
Note and assignment mis3 5.3Note and assignment mis3 5.3
Note and assignment mis3 5.3RoshanTushar1
 
3. Frequency-Domain Analysis of Continuous-Time Signals and Systems.pdf
3. Frequency-Domain Analysis of Continuous-Time Signals and Systems.pdf3. Frequency-Domain Analysis of Continuous-Time Signals and Systems.pdf
3. Frequency-Domain Analysis of Continuous-Time Signals and Systems.pdfTsegaTeklewold1
 
Module v sp
Module v spModule v sp
Module v spVijaya79
 
International Journal of Mathematics and Statistics Invention (IJMSI)
International Journal of Mathematics and Statistics Invention (IJMSI) International Journal of Mathematics and Statistics Invention (IJMSI)
International Journal of Mathematics and Statistics Invention (IJMSI) inventionjournals
 

Similaire à timecomplexity.ppt (20)

Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small ...
Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small ...Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small ...
Fractal Dimension of Space-time Diagrams and the Runtime Complexity of Small ...
 
df_lesson_01.ppt
df_lesson_01.pptdf_lesson_01.ppt
df_lesson_01.ppt
 
Fractal dimension versus Computational Complexity
Fractal dimension versus Computational ComplexityFractal dimension versus Computational Complexity
Fractal dimension versus Computational Complexity
 
Applied Calculus Chapter 2 vector valued function
Applied Calculus Chapter  2 vector valued functionApplied Calculus Chapter  2 vector valued function
Applied Calculus Chapter 2 vector valued function
 
Chapter2vectorvaluedfunction 150105020944-conversion-gate02
Chapter2vectorvaluedfunction 150105020944-conversion-gate02Chapter2vectorvaluedfunction 150105020944-conversion-gate02
Chapter2vectorvaluedfunction 150105020944-conversion-gate02
 
Computational Complexity: Complexity Classes
Computational Complexity: Complexity ClassesComputational Complexity: Complexity Classes
Computational Complexity: Complexity Classes
 
Sampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxSampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptx
 
Winter 8 TM.pptx
Winter 8 TM.pptxWinter 8 TM.pptx
Winter 8 TM.pptx
 
rcg-ch4a.pdf
rcg-ch4a.pdfrcg-ch4a.pdf
rcg-ch4a.pdf
 
Ss important questions
Ss important questionsSs important questions
Ss important questions
 
Ch4 (1)_fourier series, fourier transform
Ch4 (1)_fourier series, fourier transformCh4 (1)_fourier series, fourier transform
Ch4 (1)_fourier series, fourier transform
 
Univariate Financial Time Series Analysis
Univariate Financial Time Series AnalysisUnivariate Financial Time Series Analysis
Univariate Financial Time Series Analysis
 
Ss
SsSs
Ss
 
Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10) Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10)
 
Signals and Systems.pptx
Signals and Systems.pptxSignals and Systems.pptx
Signals and Systems.pptx
 
Signals and Systems.pptx
Signals and Systems.pptxSignals and Systems.pptx
Signals and Systems.pptx
 
Note and assignment mis3 5.3
Note and assignment mis3 5.3Note and assignment mis3 5.3
Note and assignment mis3 5.3
 
3. Frequency-Domain Analysis of Continuous-Time Signals and Systems.pdf
3. Frequency-Domain Analysis of Continuous-Time Signals and Systems.pdf3. Frequency-Domain Analysis of Continuous-Time Signals and Systems.pdf
3. Frequency-Domain Analysis of Continuous-Time Signals and Systems.pdf
 
Module v sp
Module v spModule v sp
Module v sp
 
International Journal of Mathematics and Statistics Invention (IJMSI)
International Journal of Mathematics and Statistics Invention (IJMSI) International Journal of Mathematics and Statistics Invention (IJMSI)
International Journal of Mathematics and Statistics Invention (IJMSI)
 

Dernier

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 

Dernier (20)

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 

timecomplexity.ppt