Summary of Previous Class - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Summary of Previous Class

Description:

... for time M. Max size n=M1/3. A year later speed doubled. Max size increased to. ... Let b be a maximal number of choices M has at any time when computing on x ... – PowerPoint PPT presentation

Number of Views:10
Avg rating:3.0/5.0
Slides: 24
Provided by: evgenyd
Category:

less

Transcript and Presenter's Notes

Title: Summary of Previous Class


1
Summary of Previous Class
  • Computable functions
  • Runtime of a computation and space of a
    computation
  • Big-O, small-o notation and growth of functions
  • Runtime depends on the model of computation
  • All reasonable models of computation are
    polynomially equivalent.

2
Execution Times (for a Computer that Executes 109
Instructions per Second )
3
The class P
  • P ?k TIME(nk)
  • P is robust (P is invariant for all models that
    are polynomially equivalent to a single-tape
    Turing machine).
  • P roughly corresponds to the class of problems
    that can be efficiently solvable on a computer.

4
Polinomial time - class P
  • Stable All reasonable models of computation
    are polynomially equivalent. Then if a problem is
    in P with respect to model A (runs in time
    t(n)O(nc)) then it is in P with respect to model
    B (runs in time t(n)k (O(nc))k O(nkc)).
  • Tractable (as speed increases we can solve bigger
    instances) problem can be solved in n3. You
    agreed to wait for time M. Max size nM1/3. A
    year later speed doubled. Max size increased to
    .
  • Compare problem can be solved in 2n. Max size
    nlog2 M. Speed doubled max size log2 M 1
    increased by one bit !!!!

5
Examples of Problems in P Graph Reachability
  • Path ltG,s,tgt G is a directed graph that has
    a directed path from s to t
  • Mark vertex s.
  • Repeat the following until no additional nodes
    are marked
  • Scan all edges in G. If there is an edge (a,b)
    with a marked a and an unmarked b, mark node b.
  • If t is marked, accept. Otherwise, reject.

6
In P or Not in P?
  • Graph Connectedness Given a graph G is it
    connected?
  • 3 min

7
Examples of Problems in P Graph connectedness
  • Path ltGgt G is a connected undirected graph
  • Mark vertex s.
  • Repeat the following until no additional nodes
    are marked
  • Scan all edges in G. If there is an edge (a,b)
    with a marked a and an unmarked b, mark node b.
  • If all vertexes are marked, accept. Otherwise,
    reject.

8
In P or not in P?
  • Substring Given strings s1 and s2 such that
    s1lt s2. Is s1 a substring of s2?
  • 3 min

9
Examples of Problems in P Substring
  • Substring lts1,s2gt s1 is a substring of s2
  • Compare every substring of s2 that have length
    s1 with the string s1. If there is a substring
    of s2 equal to s1 then accept. Otherwise, reject

10
Hamiltonian-Cycle Problem
  • Definition A Hamiltonian cycle in a directed
    graph is a cycle that goes through every vertex
    exactly once.
  • Hamiltonian-Cycle Problem Given a directed graph
    G, does G have a Hamiltonian cycle?
  • Algorithm Design an algorithm for solving the
    Hamiltonian-cycle problem. What is the running
    time of your algorithm?

11
Clique Problem
  • Definition A clique in an undirected graph is a
    subgraph in which every two vertices are
    connected by an edge. A k-clique is a clique that
    consists of k vertices.
  • Clique Problem Given an undirected graph G and
    an integer k, does G have a k-clique?
  • Algorithm Design an algorithm for solving the
    clique problem. What is the running time of your
    algorithm?

12
Boolean Formulas
  • Recursive definition of Boolean formulas
  • Boolean variable is a formula
  • If F is a Boolean formula then (?F) is also a
    Boolean formula
  • If F1 and F2 are Boolean formulas then (F1?F2) is
    also a Boolean formula
  • If F1 and F2 are Boolean formulas then (F1?F2) is
    also a Boolean formula.

13
Satisfiability Problem
  • Definition A Boolean formula is satisfiable if
    some assignment of 0s and 1s to its variables
    makes the formula true.
  • Satisfiability Problem Given a Boolean formula
    F, if F is satisfiable or not?
  • Algorithm Design an algorithm for solving the
    satisfiability problem. What is the running time
    of your algorithm?

14
Verifiability
  • Satisfiability Problem Given a Boolean formula
    F, if F is satisfiable or not?
  • Verification Suppose someone presents a
    particular assignment A and states that A
    satisfies F.
  • Can we verify this statement?
  • What time is required for the verification?
  • Verifying Versus Finding It is much easier to
    verify that a given assignment A satisfies F than
    to find such an assignment.

15
Another Example of Verifiability
  • Hamiltonian-Cycle Problem Given a directed graph
    G, does G have a Hamiltonian cycle?
  • Verification Suppose someone presents a cycle in
    G and states that A is a Hamiltonian cycle.
  • Can we verify this statement?
  • What time is required for the verification?

16
One More Example of Verifiability
  • Clique Problem Given an undirected graph G and
    an integer k, does G have a k-clique?
  • Verification Suppose someone presents a subgraph
    in G and states that this subgraph is a k-clique.
  • Can we verify this statement?
  • What time is required for the verification?

17
Verifiers
  • Definition
  • A verifier for a language L is an algorithm V
    such that
  • L s V accepts lts,pgt for some binary string
    p
  • The additional string p is called a proof or
    certificate.

18
Polynomial-TimeVerifiers
  • Input string s
  • Proof p
  • Definition A verifier is called a
    polynomial-time verifier if it runs in polynomial
    time in the length of s.
  • Definition A language L is called a polynomially
    verifiable L has a polynomial-time verifier.

19
The Class NP
  • Definition NP is the class of languages that
    have polynomial time verifiers.
  • Examples of problems in NP
  • Hamiltonian-cycle problem
  • Clique problem
  • Satisfiability problem

20
Nondeterministic Turing Machines
  • Nondeterministic Turing machines Similar to
    usual Turing machines, but there may be more than
    one instruction with the same left side.
  • NTM M decides L if
  • for every w?L there exists at least one
    computation that accepts w
  • for u?L every computation of M rejects u.
  • NTIME(t(n))L Lis a language decided in
    O(t(n)) time by an NTM

21
Poly Verifier for L NTM M deciding L
  • Theorem A language is in NP if and only if it is
    decided by a nondeterministic polynomial-time
    Turing machine.
  • (?) L have a verifier V that runs in time nk.
  • On an input x NTM M first generates
    non-deterministically a binary string c on a
    working tape, then it copies it eo the input tape
    and runs V on ltx,cgt.

22
Poly Verifier for L NTM M deciding L
(continued).
  • (?) NTM M decides L in time nk.
  • Verifier V is a modification of M. On an input
    ltx,cgt it executes instructions of M on ltxgt until
    it must make a choice. Then V reads a bit of c V
    takes first possibility on 0, and rejects it on
    1. V continues to the next bit until only one
    possibility left. If so V takes it.
  • Let b be a maximal number of choices M has at any
    time when computing on ltxgt. A string of length
    at most bnk is needed to model a computation.

23
Exponential-Time Algorithms for Problems in NP
  • Theorem Each language in NP can be decided by a
    deterministic exponential-time Turing machine.
  • Proof idea NTM M decides L in nk-time. M
    simulate computation of M on ltxgt by walking all
    the computational tree of M on ltxgt. Let b be a
    maximal number of choices M has at any time when
    computing on ltxgt. Then the tree size is at most
    . M walks the tree using BFS M in time
Write a Comment
User Comments (0)
About PowerShow.com