text stringlengths 0 8.13M |
|---|
the input, i.e. it is just the length of the string written on the tape in the start |
configuration. |
This is a simplification, since the number of steps required by an algorithm |
may depend on several of the parameters defining the instance of the problem. |
For example, in a graph problem, both the number of nodes and the number |
of edges may have an effect on the running time of an algorithm. On the other |
hand, the maximum number of edges in a graph with n nodes is n(n 1)/2, |
− |
20The extent to which quantum computation is stronger than classical is not yet fully |
understood. |
52 |
so using the square of the number of nodes we get a reasonable measure of the |
instance size. The idea is here that the instances are coded in some way on |
the machine tape, and coding both node data and edge data, we take this into |
account when we measure the instance size as the length of the string written |
on the tape. |
Asymptotic upper bounds |
The”bigO”notation isusedtosetupper bounds onthe asymptoticbehavior |
O |
offunctions. Wewanttocapturethenotionthatthefunctionf isasymptotically |
bounded by the function g. |
Let f and g be two functions from the natural numbers to the positive real |
numbers. f(n) is in the class of functions (g(n)), or simply f(n)= (g(n)) if |
O O |
there exist positive integers c and n such that f(n) cg(n) for every integer |
0 |
≤ |
n n . Thissimply saysthatforsufficientlylargen,the functionf isbounded |
0 |
≥ |
from above by the function g apart from a constant factor. |
Asymptotic lower bounds |
For lower bonds, the ”big Omega” Ω is used. |
Againletf andg be twofunctions fromthe naturalnumberstothepositive |
realnumbers. f(n)isintheclassoffunctionsΩ(g(n)),orsimplyf(n)=Ω(g(n)) |
ifthere exist positiveintegersc andn suchthatcg(n) f(n)for everyinteger |
0 |
≤ |
n n . Thissimply saysthatforsufficientlylargen,the functionf isbounded |
0 |
≥ |
from below by the function g apart from a constant factor. |
Asymptotic behavior |
If a function f is in both (g) and Ω(g), i.e. if it, apart from constant factors, |
O |
is bounded both fromabove and below by the same function g, then it behaves |
asymptotically as g. The ”big Θ” notation is used to indicate this. |
Thus, f(n) is in Θ(g(n)) if it is in both (g(n)) and Ω(g(n)). |
O |
Time complexity |
The time complexity of a deterministic Turing machine M is a function |
f : N N, where f is the maximum number of steps performed by M during |
→ |
any computation with input length n. |
This is also phrased in any of the following ways: f is the running time of |
M, M runs in time f, M is a time f machine. |
The time complexity class TIME(f(n)), is defined as |
TIME(f(n))= L L is decided by an (f(n)) time machine . (2.25) |
{ | O } |
There is a corresponding notion of time complexity for non-deterministic |
computations. The time complexity of a non-deterministic Turing machine M |
53 |
is a function f : N N, where f is the maximum number of steps performed |
→ |
by M on any branch of the computation with input length n. |
Space complexity |
The space complexity of a deterministic Turing machine M is a function |
f : N N, where f is the maximum number of tape cells scanned by M |
→ |
during any computation with input length n. |
This is also phrased in any of the following ways: M runs in space f, M is |
a space f machine. |
The space complexity class SPACE(f(n)), is defined as |
SPACE(f(n))= L L is decided by an (f(n)) space machine (2.26) |
{ | O } |
Analysis of algorithms |
Algorithms areanalyzedby roughly estimating the number of steps requiredto |
perform the parts of the algorithm. Textbooks on complexity theory normally |
goes through the techniques of doing this. The details differs from model to |
model depending on the programming primitive available. We will bypass this |
topic here,andjust relyonourintuitioninthe simple models weareconcerned |
with, Turing machines and circuits. |
2.8.2 Complexity classes |
For easy reference,we will briefly review the definitions of the basic complexity |
classes. |
The class P |
The time complexity class P is the collection of all languages that are in |
TIME(nk)forsomeconstantk. Thatis,alanguageis inPifitcanbe decided |
by a deterministic Turing machine whose running time is bounded from above |
by a polynomial in the number of steps. |
The class NP |
NP is an extremely important time complexity class. Its name is an abbre- |
viation of Non-deterministic Polynomial. It is defined as the collection of all |
languages that are in NTIME(nk) for some constant k. That is, a language is |
in NP if it can be decided by a non-deterministic Turing machine whose run- |
ning time is bounded from above by a polynomial in the number of steps. This |
class is potentially larger than P, indeed P NP. |
⊆ |
ThereisanothercharacterizationofNPthatdonotrefertonon-deterministic |
computations. It is based on the easy (polynomial) verification of a ”yes” in- |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.