Time complexity
Download
1 / 34

Time Complexity - PowerPoint PPT Presentation


  • 70 Views
  • Uploaded on

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.

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

PowerPoint Slideshow about ' Time Complexity' - francesca-roberts


An Image/Link below is provided (as is) to download presentation

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

Time Complexity

Costas Busch - RPI


Time complexity

Consider a deterministic Turing Machine

which decides a language

Costas Busch - RPI


Time complexity

For any string the computation of

terminates in a finite amount of transitions

Initial

state

Accept

or Reject

Costas Busch - RPI


Time complexity

Decision Time = #transitions

Initial

state

Accept

or Reject

Costas Busch - RPI


Time complexity

Consider now all strings of length

= maximum time required to decide

any string of length

Costas Busch - RPI


Time complexity

TIME

STRING LENGTH

Max time to accept a string of length

Costas Busch - RPI


Time complexity

Time Complexity Class:

All Languages decidable by a deterministic Turing Machine

in time

Costas Busch - RPI


Time complexity

Example:

This can be decided in time

Costas Busch - RPI



Time complexity

Examples in class:

Costas Busch - RPI


Time complexity

Examples in class:

CYK algorithm

Matrix multiplication

Costas Busch - RPI


Time complexity

Polynomial time algorithms:

constant

Represents tractable algorithms:

for small we can decide

the result fast

Costas Busch - RPI


Time complexity

It can be shown:

Costas Busch - RPI


Time complexity

The Time Complexity Class

Represents:

  • polynomial time algorithms

  • “tractable” problems

Costas Busch - RPI


Time complexity

Class

CYK-algorithm

Matrix multiplication

Costas Busch - RPI


Time complexity

Exponential time algorithms:

Represent intractable algorithms:

Some problem instances

may take centuries to solve

Costas Busch - RPI


Time complexity

Example: the Hamiltonian Path Problem

s

t

Question: is there a Hamiltonian path

from s to t?

Costas Busch - RPI


Time complexity

s

t

YES!

Costas Busch - RPI


Time complexity

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


Time complexity

The clique problem

Does there exist a clique of size 5?

Costas Busch - RPI


Time complexity

The clique problem

Does there exist a clique of size 5?

Costas Busch - RPI


Time complexity

Example: The Satisfiability Problem

Boolean expressions in

Conjunctive Normal Form:

clauses

Variables

Question: is the expression satisfiable?

Costas Busch - RPI


Time complexity

Example:

Satisfiable:

Costas Busch - RPI


Time complexity

Example:

Not satisfiable

Costas Busch - RPI


Time complexity

exponential

Algorithm:

search exhaustively all the possible

binary values of the variables

Costas Busch - RPI


Non determinism
Non-Determinism

Language class:

A Non-Deterministic Turing Machine

decides each string of length

in time

Costas Busch - RPI



Time complexity

The class

Non-Deterministic Polynomial time

Costas Busch - RPI


Time complexity

The satisfiability problem

Example:

Non-Deterministic algorithm:

  • Guess an assignment of the variables

  • Check if this is a satisfying assignment

Costas Busch - RPI


Time complexity

Time for variables:

  • Guess an assignment of the variables

  • Check if this is a satisfying assignment

Total time:

Costas Busch - RPI



Time complexity

Observation:

Deterministic

Polynomial

Non-Deterministic

Polynomial

Costas Busch - RPI


Time complexity

Open Problem:

WE DO NOT KNOW THE ANSWER

Costas Busch - RPI


Time complexity

Open Problem:

Example: Does the Satisfiability problem

have a polynomial time

deterministic algorithm?

WE DO NOT KNOW THE ANSWER

Costas Busch - RPI