p and np n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
P and NP PowerPoint Presentation
Download Presentation
P and NP

Loading in 2 Seconds...

play fullscreen
1 / 18

P and NP - PowerPoint PPT Presentation


  • 56 Views
  • Uploaded on

P and NP. Sipser 7.2-7.3 (pages 256-270). Polynomial time. P =∪ k TIME(n k ) …. TIME(n 3 ). TIME(n 2 ). TIME(n ). “Practical” problems. If n = 100 n 3 = 1 billion 2 n > #atoms in the universe

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 'P and NP' - fletcher-jenkins


Download Now 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
p and np

P and NP

Sipser 7.2-7.3 (pages 256-270)

polynomial time
Polynomial time

P =∪kTIME(nk)

TIME(n3)

TIME(n2)

TIME(n)

practical problems
“Practical” problems
  • If n = 100
    • n3 = 1 billion
    • 2n > #atoms in the universe
  • Polynomial time is generally considered “practical” for a computer
  • P is the class of “solvable” or “tractable” problems
how many tapes
How many tapes?
  • Definition 7.12:

P is the class of languages that are decidable in polynomial time by a deterministic single-tape Turing machine.

  • But remember… we can convert from single-tape to multi-tape!
    • What was the time complexity conversion?
polynomially equivalent models
Polynomially equivalent models

0

1

0

1

0

M

a

a

a

b

a

S

0

#

1

0

1

0

#

a

a

a

#

b

a

#

finding your way
Finding your way
  • PATH = {<G,s,t>|∃ directed s to t path in G}

s

t

path p
PATH ∈ P
  • M = "On input <G,s,t>:
    • Place a mark on node s.
    • Repeat until no additional nodes are marked:
    • Scan all edges of G.

If (a,b) found from marked node

to unmarked node, mark b.

    • If t is marked, accept. Otherwise, reject.
hamiltonian paths
Hamiltonian paths
  • HAMPATH = {<G,s,t> | ∃ Hamiltonian path from s to t}

s

t

hamiltonian paths1
Hamiltonian paths
  • HAMPATH = {<G,s,t> | ∃ Hamiltonian path from s to t}

s

t

checking for hamiltonian paths
Checking for Hamiltonian paths
  • Brute force method
  • E = "On input <G,s,t>:
    • Generate all orderings, p1, p2,..., pn, of the nodes of G
    • Check whether s = p1 and t = pn
    • For each i=1 to n-1, check whether (pi, pi+1) is an edge of G.

If any are not, reject. Otherwise, accept.”

guessing a solution
Guessing a solution
  • N = "On input <G,s,t>:
    • Guess an orderings, p1, p2,..., pn, of the nodes of G
    • Check whether s = p1 and t = pn
    • For each i=1 to n-1, check whether (pi, pi+1) is an edge of G.

If any are not, reject. Otherwise, accept.”

nondeterministic time complexity
Nondeterministic time complexity
  • Definition 7.9: Let N be a NTM. The running time of N is a function f: N → N, where f(n) is the maximum number of steps that N uses on any branch of its computation on any input of length n

Nondeterministic

Deterministic

f(n)

f(n)

f(n)

nondeterministic time complexity classes
Nondeterministic time complexity classes
  • Definition 7.21:

NTIME(t(n)) =

{L | L is decided in O(t(n)) time by an NTM}

verifiers
Verifiers
  • Definition 7.18:
    • A verifier for a language A is an algorithm V, where

A = {w | V accepts <w,c> for some string c}

    • A polynomial time verifier runs in polynomial time in the length of w
    • A language A is polynomially verifiable if it has a polynomial time verifier
the class np
The class NP
  • Definition 7.19:

NP is the class of languages that have polynomial time verifiers

nondeterminism and verifiers
Nondeterminism and verifiers
  • Theorem 7.20:

A language is in NP iff it is decided by some nondeterministic polynomial time Turing machine

  • Corollary 7.19: NP = ∪kNTIME(nk)
the classes p and np
The classes P and NP

NP =∪kNTIME(nk)

P =∪kTIME(nk)

the big question p np
The big question: P = NP?

P ⊆ NP ⊆ PSPACE = NPSPACE ⊆ EXPTIME

proper containment