Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Complexity class
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Computational models=== To make concrete the notion of a "computer", in theoretical computer science problems are analyzed in the context of a [[computational model]]. Computational models make exact the notions of computational resources like "time" and "memory". In [[computational complexity theory]], complexity classes deal with the ''inherent'' resource requirements of problems and not the resource requirements that depend upon how a physical computer is constructed. For example, in the real world different computers may require different amounts of time and memory to solve the same problem because of the way that they have been engineered. By providing an abstract mathematical representations of computers, computational models abstract away superfluous complexities of the real world (like differences in [[Processor (computing)|processor]] speed) that obstruct an understanding of fundamental principles. The most commonly used computational model is the [[Turing machine]]. While other models exist and many complexity classes are defined in terms of them (see section [[Complexity class#Other models of computation|"Other models of computation"]]), the Turing machine is used to define most basic complexity classes. With the Turing machine, instead of using standard units of time like the second (which make it impossible to disentangle running time from the speed of physical hardware) and standard units of memory like [[byte]]s, the notion of time is abstracted as the number of elementary steps that a Turing machine takes to solve a problem and the notion of memory is abstracted as the number of cells that are used on the machine's tape. These are explained in greater detail below. It is also possible to use the [[Blum axioms]] to define complexity classes without referring to a concrete [[computational model]], but this approach is less frequently used in complexity theory. ====Deterministic Turing machines==== {{Main|Turing machine}} [[File:Turing machine 2b.svg|thumb|right|An illustration of a Turing machine. The "B" indicates the blank symbol.]] A '''Turing machine''' is a mathematical model of a general computing machine. It is the most commonly used model in complexity theory, owing in large part to the fact that it is believed to be as powerful as any other model of computation and is easy to analyze mathematically. Importantly, it is believed that if there exists an algorithm that solves a particular problem then there also exists a Turing machine that solves that same problem (this is known as the [[Church–Turing thesis]]); this means that it is believed that ''every'' algorithm can be represented as a Turing machine. Mechanically, a Turing machine (TM) manipulates symbols (generally restricted to the bits 0 and 1 to provide an intuitive connection to real-life computers) contained on an infinitely long strip of tape. The TM can read and write, one at a time, using a tape head. Operation is fully determined by a finite set of elementary instructions such as "in state 42, if the symbol seen is 0, write a 1; if the symbol seen is 1, change into state 17; in state 17, if the symbol seen is 0, write a 1 and change to state 6". The Turing machine starts with only the input string on its tape and blanks everywhere else. The TM accepts the input if it enters a designated accept state and rejects the input if it enters a reject state. The deterministic Turing machine (DTM) is the most basic type of Turing machine. It uses a fixed set of rules to determine its future actions (which is why it is called "[[deterministic]]"). A computational problem can then be defined in terms of a Turing machine as the set of input strings that a particular Turing machine accepts. For example, the primality problem <math>\texttt{PRIME}</math> from above is the set of strings (representing natural numbers) that a Turing machine running an algorithm that correctly [[primality test|tests for primality]] accepts. A Turing machine is said to '''recognize''' a language (recall that "problem" and "language" are largely synonymous in computability and complexity theory) if it accepts all inputs that are in the language and is said to '''decide''' a language if it additionally rejects all inputs that are not in the language (certain inputs may cause a Turing machine to run forever, so [[Recursive set|decidability]] places the additional constraint over [[Recursively enumerable set|recognizability]] that the Turing machine must halt on all inputs). A Turing machine that "solves" a problem is generally meant to mean one that decides the language. Turing machines enable intuitive notions of "time" and "space". The [[time complexity]] of a TM on a particular input is the number of elementary steps that the Turing machine takes to reach either an accept or reject state. The [[space complexity]] is the number of cells on its tape that it uses to reach either an accept or reject state. ====Nondeterministic Turing machines==== {{Main|Nondeterministic Turing machine}} [[Image:Difference_between_deterministic_and_Nondeterministic.svg|thumb|350px|right| A comparison of deterministic and nondeterministic computation. If any branch on the nondeterministic computation accepts then the NTM accepts.]] The deterministic Turing machine (DTM) is a variant of the nondeterministic Turing machine (NTM). Intuitively, an NTM is just a regular Turing machine that has the added capability of being able to explore multiple possible future actions from a given state, and "choosing" a branch that accepts (if any accept). That is, while a DTM must follow only one branch of computation, an NTM can be imagined as a computation tree, branching into many possible computational pathways at each step (see image). If at least one branch of the tree halts with an "accept" condition, then the NTM accepts the input. In this way, an NTM can be thought of as simultaneously exploring all computational possibilities in parallel and selecting an accepting branch.{{sfn|Sipser|2006|p=48, 150}} NTMs are not meant to be physically realizable models, they are simply theoretically interesting abstract machines that give rise to a number of interesting complexity classes (which often do have physically realizable equivalent definitions). The [[time complexity]] of an NTM is the maximum number of steps that the NTM uses on ''any'' branch of its computation.{{sfn|Sipser|2006|p=255}} Similarly, the [[space complexity]] of an NTM is the maximum number of cells that the NTM uses on any branch of its computation. DTMs can be viewed as a special case of NTMs that do not make use of the power of nondeterminism. Hence, every computation that can be carried out by a DTM can also be carried out by an equivalent NTM. It is also possible to simulate any NTM using a DTM (the DTM will simply compute every possible computational branch one-by-one). Hence, the two are equivalent in terms of computability. However, simulating an NTM with a DTM often requires greater time and/or memory resources; as will be seen, how significant this slowdown is for certain classes of computational problems is an important question in computational complexity theory.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)