0% found this document useful (0 votes)
76 views5 pages

Theory of Computation

This document discusses time complexity, space complexity, and their relationship. It defines: - Time complexity as the amount of time an algorithm takes based on input size. Problems fall into complexity classes like P, NP, and NP-Complete. - Space complexity as the amount of memory required. The Savitch theorem shows nondeterministic space complexity can be converted to deterministic space complexity using more space. - The relationship between time and space complexity, with nondeterministic time complexity potentially exponential compared to deterministic, but space complexity increased by a smaller polynomial amount when converting between models. In summary, it analyzes the complexity classes and relationship between the complexities of time and space for algorithms.

Uploaded by

Rehan Shabbir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views5 pages

Theory of Computation

This document discusses time complexity, space complexity, and their relationship. It defines: - Time complexity as the amount of time an algorithm takes based on input size. Problems fall into complexity classes like P, NP, and NP-Complete. - Space complexity as the amount of memory required. The Savitch theorem shows nondeterministic space complexity can be converted to deterministic space complexity using more space. - The relationship between time and space complexity, with nondeterministic time complexity potentially exponential compared to deterministic, but space complexity increased by a smaller polynomial amount when converting between models. In summary, it analyzes the complexity classes and relationship between the complexities of time and space for algorithms.

Uploaded by

Rehan Shabbir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

COMPUTATION COMPLEXITIES

(Time Complexity and Space Complexity and their inter-relationship)

Rehan Shabbir Khan


Virtual University of Pakistan
MS070400056 | [email protected]

Abstract steps, number of cells in Turing machine


or space in memory required to solve
This paper simplifies the concept of
that problem. [1]
computation complexities in context of
time complexity, space complexity and A problem complexity is measured in
their inter-relationship as well as classify terms of polynomial, non-deterministic
the complexity, its measuring tool and polynomial and exponential complexity.
the types of algorithms to solve some It refers to solve a problem in given
problems. It also defines the new amount of time and space. Turing
dimensions of research work to unfold machine is one of the tool to construct
the behavior of these complexities. The such smart algorithms that decide these
basic questions are that; do we compute complexities. [1] Among different types
everything? How complex a problem can of Turing machines, we keep focusing on
be? The answer to this question can be deterministic and non-deterministic
realized by learning basic principles of Turing machines to exemplifies the space
computation as described in this paper. complexity and the time complexity in
this paper.

Time Complexity
Introduction
The quantity of time taken by an
Decision problems are defined on the
algorithm to run as a function of the
scale of complexities. The worst case
length of input string is called the time
scenario is the upper bound refer to as
complexity and represented by big O
Big O, contrary the best case scenario is
notation also called asymptotic notation.
the lower bond of complexity commonly
For measuring the time complexity of an
known as Omega Ω. The algorithms are
algorithm we consider only the highest
constructed to solve the problems based
order term of the function as it
on their complexities. Complexity is the
dominates the lower order terms and the
measure of algorithm to solve a specific
effect of coefficient. Let’s take the given
problem. In case of time complexity, we
function f(n)=4n3+2n2+10n+10, here the
generally talking about the time taken by
higher order term is 4n3. We say this
an algorithm to solve a particular
function is asymptotically f(n)=(On3). [1]
problem. Similarly, if we talk about space
complexity we take it as the depth of
COMPUTATION COMPLEXITIES
(Time Complexity and Space Complexity and their inter-relationship)

Rehan Shabbir Khan


Virtual University of Pakistan
MS070400056 | [email protected]

Levels of Time Complexity class P like PATH Problem, Relatively


Prime Problem, Context free languages,
The time complexity can be further
etc.
defined in the following levels;
The Class NP
O (1) = constant time complexity
The class NP represents the set of
O (Log n) = logarithmic time complexity
decision problems that can be solved
O (n) = linear time complexity with nondeterministic TM in polynomial
time. [2] The class NP have a polynomial
O (n2) = quadric time complexity
time verifier. The class NP has a set of
O (nc) = polynomial time complexity languages which are verified quickly.
O (cn) = exponential time complexity Following problems are considered in
class NP like HAMPATH, CLIQUE,
O (∞) = infinite time complexity SUBSET-SUM, etc.
Polynomial time refers to the function The Class NP Complete
having powers of some variables, its
running time is much lesser than the The Class NP Complete represents the set
exponential function which is considered of decision problems that if one of them
very large. For example, the term 10002 is is solvable in polynomial time than all
equal to 1 billion although it refers to problems in that set are polynomial time
polynomial time. Whereas the term 21000 solvable. We say that If we device an
is exponentially large. The sorting and algorithm to solve a problem in NP
searching algorithms generally takes Complete class then all problems in that
polynomial time whereas the scheduling set are solvable using that algorithm in
algorithms can take exponential time. [1] polynomial time. Here comes the
concept of reducibility in polynomial
The Class P time. Following problems construct the
The class P is most robust class. It set of NP-Complete like 3SAT reducible
contains all the decision problems that to CLIQUE, VERTEX-COVER, SUBSET-SUM
can be solved with deterministic TM in and HAMPATH in polynomial time.
polynomial time. [2] The class P has a set Space Complexity
of languages which are decided quickly.
Following problem can be referred to
COMPUTATION COMPLEXITIES
(Time Complexity and Space Complexity and their inter-relationship)

Rehan Shabbir Khan


Virtual University of Pakistan
MS070400056 | [email protected]

Space complexity is the amount of technique, a significant amount of pace is


memory that is required to run an saved. In this recursion each part uses
algorithm to solve a decision problem. O(f(n)) space where depth of recursion is
Mathematically we can say that log t. So we get log t = O (f(n)). [5]
complexity of M is the function
Relation Ship Between Time and Space
f(n): NN, where f(n) is the maximum
Complexities
number of cells that M scans on a given
input of length ‘n’. The Space complexity An algorithm in a non-deterministic
SPACE (f(n)) is decidable through Turing Machine may has the time
deterministic Turing machine and the complexity of t(n) and in deterministic
NSPCASE (f(n)) is decidable through non- Turing Machine it may be 2O (t(n)). We can
deterministic Turing machine. see that the difference in time complexity
of non-deterministic and deterministic
SAVITCH THEOREM
Turing Machine is exponential as
According to this theorem the nondeterministic Turing Machine takes q
nondeterministic Turing machines can be non-deterministic choices for q-states in
simulated through deterministic Turing a particular problem.
machines. In simple words a
An algorithm in a non-deterministic
nondeterministic algorithm can be
Turing Machine may has the space
converted into deterministic algorithm
complexity of t(n) and in deterministic
by using comparatively much smaller
Turing Machine it may be s(n)+O(t(n)).
amount of space like and NTM the uses
The difference in SPACE complexity is
f(n) space can be converted to DTM that
much smaller as space is reused to keep
only uses f2(n) space. For any function f
track of choices at each step of
(n) where f(n) ≥n we can write that.
transaction. [5]
NSPACE (f(n)) ⊆SPACE (f2(n)) [3]
Conclusion
To determine a solution, we divide the
We discuss the Time and space
problem and use a recursive algorithm
complexities and their behavior in a very
that solve a part of problem in half of the
simplified way we further elaborate that
space and by reusing the same space we
the PSPACE and NPSPACE are the set of
can determine the solution of the
problems that takes at most polynomial
remaining part of problem. By using this
COMPUTATION COMPLEXITIES
(Time Complexity and Space Complexity and their inter-relationship)

Rehan Shabbir Khan


Virtual University of Pakistan
MS070400056 | [email protected]

space to be solved on deterministic or polynomial time to be solved on


non-deterministic Turing Machine. deterministic or non-deterministic Turing
Machine. In a nutshell Computational
Whereas, the classes P and NP contains
complexities ranges between constant
the set of problems that takes at most
time to infinite time.
COMPUTATION COMPLEXITIES
(Time Complexity and Space Complexity and their inter-relationship)

Rehan Shabbir Khan


Virtual University of Pakistan
MS070400056 | [email protected]

References:

1. INTRODUCTION TO THE THEORY OF COMPUTATION-SECOND EDITION


BY MICHAEL SIPSER
MASSACHUSETTS INSTITUTE OF TECHNOLOGY

2. THE P VERSUS NP PROBLEM


STEPHEN COOK

3. Space-Time Symmetries in Gauge Theories


P. Forgacs and N. S. Manton

4. An unwelcome consequence of the Multiverse Thesis


N. EFFINGHAM

5. Complexity and algorithms for non-linear optimization problems


DORIT S. HOCHBAUM

You might also like