efficient algorithms and problem complexity more
play

Efficient Algorithms and Problem Complexity More Complexity Classes - PowerPoint PPT Presentation

Efficient Algorithms and Problem Complexity More Complexity Classes Frank Drewes Department of Computing Science Ume University Frank Drewes (Ume University) Efficient Algorithms and Problem Complexity Lecture 14 1 / 11 Outline


  1. Efficient Algorithms and Problem Complexity – More Complexity Classes – Frank Drewes Department of Computing Science Umeå University Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 1 / 11

  2. Outline Today’s Menu Space Complexity 1 Complement Classes 2 Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 2 / 11

  3. Space Complexity Space Instead of asking how quickly a problem can be solved, we may ask how much memory is required. How to define the memory requirements of an algorithm? In contrast to time, memory can be re-used. The input is in memory, but should not be counted towards used memory. However, if we change input registers, this is usage that should count. Consequently, we count how many bits are stored in the registers actually in use. Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 3 / 11

  4. Space Complexity Space Formalizing the space consumption of a RAM M with input x : Let used M ( x ) denote the set of all i ∈ N such that some step during M ’s run assigns a value to register R i . A configuration of the run of M is said to use � i ∈ used M ( X ) � R i � memory space. The space used by M with input x is the maximum of the memory space used by the configurations in the run of M with input x . M is said to run in space f ( n ) if it uses at most f ( � x � ) space for every input x . The corresponding definitions for nondeterministic RAMs are similar. Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 4 / 11

  5. Space Complexity Space Complexity Classes General notation: DSPACE ( f ( n )) = all decision problems solvable by RAMs in space f ( n ) . NSPACE ( f ( n )) = all decision problems solvable by nRAMs in space f ( n ) . The most important space complexity classes are L = DSPACE ( O (log n )) and NL = NSPACE ( O (log n )) . LIN = DSPACE ( O ( n )) and NLIN = NSPACE ( O ( n )) . k ∈ N DSPACE ( O ( n k )) . PSPACE = � Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 5 / 11

  6. Space Complexity Some Inclusions L ⊆ NL ⊆ P ⊆ NP ⊆ PSPACE = NPSPACE ⊆ EXP ⊆ NEXP (1) (2) (3) (4) (5) (6) (7) The inclusions (1) , (3) , (7) (and one direction of (5) ) are trivial. The proof of (4) uses depth-first search and the observation that a polynomial-time nRAM can only use a polynomial amount of space. (5) is Savitch’s Theorem which shows how to turn an nRAM running in space O ( f ( n )) into a RAM running in space O ( f ( n ) 2 ) . (2) and (6) can be shown by an instance of the REACHABILITY method. (Savitch’s Theorem also uses this method.) Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 6 / 11

  7. Space Complexity REACHABILITY REACHABILITY Input: A directed graph G = ( V , E ) and nodes s , t ∈ V . Question: Is there a path in G from s to t ? Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 7 / 11

  8. Space Complexity The REACHABILITY Method The REACHABILITY method is based on the following observations: An nRAM M processing x in space f ( n ) has 2 O ( f ( n )) configurations ⇒ the set of configurations yields a digraph G M , x of size 2 O ( f ( n )) , where an edge ( c , c ′ ) means that a computation step leads from c to c ′ . Therefore, M ( x ) = 1 if and only if an accepting configuration is reachable from the initial configuration in G M , x . For graphs of size m , REACHABILITY ∈ DSPACE ( O ((log m ) 2 )) . ⇒ NSPACE ( O ( f ( n ))) ⊆ DSPACE ((log2 O ( f ( n )) ) 2 ) = DSPACE ( O ( f ( n ) 2 )). REACHABILITY can also be solved in time O ( m 2 ) ⇒ NSPACE ( O ( f ( n ))) ⊆ DTIME ((2 O ( f ( n )) ) 2 ) = DTIME (2 O ( f ( n )) ). In particular, NL ⊆ P and PSPACE = NPSPACE ⊆ EXP. Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 8 / 11

  9. Complement Classes Complement Classes Definition (complements) The complement of a decision problem A is A = { x | x ∉ A } . For a class C of problems, co C = { A | A ∈ C } . Notes: Strictly speaking, A also contains all ill-formed instances, but we usually consider only valid instances of a problem. Example: SAT is the set of all unsatisfiable Boolean formulas. For every deterministic complexity class C , we have co C = C . [WHY?] We say that deterministic classes are closed under complement. For nondeterministic complexity classes, this is not apriori clear. Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 9 / 11

  10. Complement Classes The Immerman-Szelepcsényi Theorem Nondeterministic space is closed under complement: Theorem (Immerman and Szelepcsényi) Let f ( n ) ≥ log n , and let C be the set of all problems that can be decided nondeterministically in space O ( f ( n )) . Then co C = C . Notes: The function f has to fulfill a few basic requirements (to exclude weird functions). The proof is a wonderful application of the REACHABILITY method, based on an algorithm that shows that REACHABILITY ∈ NL. Immerman and Szelepcsényi were awarded the Gödel prize for their result in 1995. Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 10 / 11

  11. Complement Classes The Situation for Polynomial Time coNPC NPC coNP NP P NP �= coNP if and only if NPC ∩ coNPC = � . But perhaps NP = coNP but P �= NP? If P �= NP then NP �= P ∪ NPC (and, of course, similarly for coNP). Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 11 / 11

Recommend


More recommend