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

efficient algorithms and problem complexity more
SMART_READER_LITE
LIVE PREVIEW

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 / 12 Outline


slide-1
SLIDE 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 / 12

slide-2
SLIDE 2

Outline

Today’s Menu

1

Space Complexity

2

Complement Classes

Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 2 / 12

slide-3
SLIDE 3

Space Complexity

Memory Space – Another Precious Resource

Instead of asking how quickly a problem can be solved, we may ask how much memory is required. To study memory requirements, Turing machines (TMs) are more suitable than RAMs. The use of RAMs would create problems because arbitrarily large numbers fit in one register.

Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 3 / 12

slide-4
SLIDE 4

Space Complexity

How to Define the Memory Requirements of an Algorithm?

Important aspects to keep in mind: In contrast to time, memory can be re-used. The input is in memory, but should not be viewed as used memory

⇒ input should be read-only.

However, if we use additional memory, this is usage that should count. Output should not be counted either

⇒ output should be write-only.

Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 4 / 12

slide-5
SLIDE 5

Space Complexity

How to Define the Memory Requirements of an Algorithm?

A suitable type of TM to take care of these aspects: We consider TMs M with

⋆ one read-only input tape (M never writes anything on it), ⋆ k > 0 read-write work tapes, and ⋆ one write-only output tape (M always moves one cell to the right

when it has written a symbol on it). Consider a computation such that the right-most positions on the work tapes visited by the head are i1,...,ik. Then i1+···+ik is the space used.

M is said to run in space f (n) if it uses at most f (|x|) space for every

input x (where |x| denotes the length of x). The corresponding definitions for nondeterministic space are similar.

Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 5 / 12

slide-6
SLIDE 6

Space Complexity

Space Complexity Classes

General notation: DSPACE(f (n)) = all decision problems that are deterministically solvable in space f (n). NSPACE(f (n)) = all decision problems that are nondeterministically solvable in space f (n). Note: We only look at “well-behaved” functions f to exclude weird effects. The most important space complexity classes are L = DSPACE(O(logn)) and NL = NSPACE(O(logn)). LIN = DSPACE(O(n)) and NLIN = NSPACE(O(n)). PSPACE =

k∈NDSPACE(O(nk)).

Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 6 / 12

slide-7
SLIDE 7

Space Complexity

Some Inclusions

L ⊆

(1)

NL ⊆

(2)

P ⊆

(3)

NP ⊆

(4)

PSPACE =

(5)

NPSPACE ⊆

(6)

EXP ⊆

(7)

NEXP 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 computation can only use polynomial space.

(5) is Savitch’s Theorem which establishes for space what we would like

to know for time (i.e, P = NP). The proofs of (2), (5), and (6) can all be seen as applications of the REACHABILITY method.

Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 7 / 12

slide-8
SLIDE 8

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 8 / 12

slide-9
SLIDE 9

Space Complexity

The REACHABILITY Method

The REACHABILITY method is based on the following observations: A nondet. TM M working in space f (n) has 2O(f (n)) configurations

⇒ the set of configurations yields a digraph GM,x of size 2O(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 GM,x. For graphs of size m, REACHABILITY ∈ DSPACE(O((logm)2)).

⇒ NSPACE(O(f (n))) ⊆ DSPACE((log2O(f (n)))2) = DSPACE(O(f (n)2)).

REACHABILITY can also easily be solved in time O(m2)

⇒ NSPACE(O(f (n))) ⊆ DTIME((2O(f (n)))2) = DTIME(2O(f (n))).

In particular, NL ⊆ P and PSPACE = NPSPACE ⊆ EXP.

Frank Drewes (Umeå University) Efficient Algorithms and Problem Complexity Lecture 14 9 / 12

slide-10
SLIDE 10

Complement Classes

Complement Classes

Definition (complements) The complement of a decision problem A is A = {x | x ∉ A}. For a class C of problems, coC = {A | A ∈ C }. 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 coC = 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 10 / 12

slide-11
SLIDE 11

Complement Classes

The Immerman-Szelepcsényi Theorem

Nondeterministic space is closed under complement: Theorem (Immerman and Szelepcsényi) Let f (n) ≥ logn, and let C be the set of all problems that can be decided nondeterministically in space O(f (n)). Then coC = C . 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 11 / 12

slide-12
SLIDE 12

Complement Classes

The Situation for Polynomial Time

NP NPC coNP coNPC 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 12 / 12