1 / 34

# Time Complexity - PowerPoint PPT Presentation

Time Complexity. Consider a deterministic Turing Machine which decides a language. For any string the computation of terminates in a finite amount of transitions. Initial state. Accept or Reject. Decision Time = #transitions. Initial state. Accept or Reject.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about ' Time Complexity' - francesca-roberts

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Time Complexity

Costas Busch - RPI

Consider a deterministic Turing Machine

which decides a language

Costas Busch - RPI

terminates in a finite amount of transitions

Initial

state

Accept

or Reject

Costas Busch - RPI

Decision Time = #transitions

Initial

state

Accept

or Reject

Costas Busch - RPI

= maximum time required to decide

any string of length

Costas Busch - RPI

STRING LENGTH

Max time to accept a string of length

Costas Busch - RPI

All Languages decidable by a deterministic Turing Machine

in time

Costas Busch - RPI

This can be decided in time

Costas Busch - RPI

Costas Busch - RPI

Costas Busch - RPI

CYK algorithm

Matrix multiplication

Costas Busch - RPI

constant

Represents tractable algorithms:

for small we can decide

the result fast

Costas Busch - RPI

Costas Busch - RPI

Represents:

• polynomial time algorithms

• “tractable” problems

Costas Busch - RPI

CYK-algorithm

Matrix multiplication

Costas Busch - RPI

Represent intractable algorithms:

Some problem instances

may take centuries to solve

Costas Busch - RPI

Example: the Hamiltonian Path Problem

s

t

Question: is there a Hamiltonian path

from s to t?

Costas Busch - RPI

t

YES!

Costas Busch - RPI

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

Costas Busch - RPI

Does there exist a clique of size 5?

Costas Busch - RPI

Does there exist a clique of size 5?

Costas Busch - RPI

Example: The Satisfiability Problem

Boolean expressions in

Conjunctive Normal Form:

clauses

Variables

Question: is the expression satisfiable?

Costas Busch - RPI

Satisfiable:

Costas Busch - RPI

Not satisfiable

Costas Busch - RPI

Algorithm:

search exhaustively all the possible

binary values of the variables

Costas Busch - RPI

Language class:

A Non-Deterministic Turing Machine

decides each string of length

in time

Costas Busch - RPI

Costas Busch - RPI

Non-Deterministic Polynomial time

Costas Busch - RPI

Example:

Non-Deterministic algorithm:

• Guess an assignment of the variables

• Check if this is a satisfying assignment

Costas Busch - RPI

• Guess an assignment of the variables

• Check if this is a satisfying assignment

Total time:

Costas Busch - RPI

Costas Busch - RPI

Deterministic

Polynomial

Non-Deterministic

Polynomial

Costas Busch - RPI

WE DO NOT KNOW THE ANSWER

Costas Busch - RPI

Example: Does the Satisfiability problem

have a polynomial time

deterministic algorithm?

WE DO NOT KNOW THE ANSWER

Costas Busch - RPI