Space Complexity
Nabil Mustafa Computability and Complexity
Nabil Mustafa Space ComplexityTime and Space
Crawling, on the planet’s face. Some insects, called the human race. Lost in time, and lost in space ... and in meaning. – Rocky Picture Horror Show (1973)
Nabil Mustafa Space ComplexityDefining Space Complexity
So far, concerned with the resource of time P : Class of algorithms running in at most polynomial time NP : Class of algorithms running in at most exponential time Space is the other resource Space-Bounded Complexity Given
1 A function S : N → N 2 A TM M that decides a language Lwe say M has space complexity S(n) if M decides L using O(S(|x|)) distinct cells on the work-tape on input x. Note: Don’t count the space used in the read-only input tape.
Nabil Mustafa Space ComplexityDefining the Class SPACE
The Class SPACE SPACE (S(n)): set of functions computable in space at most c · S(n) for some constant c > 0. For example, SPACE (n2) is the set of all functions computable in at most O(n2) space. S1(n) = O(S2(n)) = ⇒ SPACE (S1(n)) ⊆ SPACE (S2(n)) The Class PSPACE PSPACE =
- c≥1
SPACE (nc) The class PSPACE contains all classes SPACE (S(n)) where S(n) is a polynomial of finite degree.
Nabil Mustafa Space Complexity