ELEMENTARY: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Austinfeller
No edit summary
 
No edit summary
Line 1: Line 1:
In [[computer science]], a '''nondeterministic algorithm''' is an [[algorithm]] that can exhibit different behaviors on different runs, as opposed to a [[deterministic algorithm]]. There are several ways an algorithm may behave differently from run to run. A [[concurrent algorithm]] can perform differently on different runs due to a [[race condition]]. A [[probabilistic algorithm]]'s behaviors depends on a [[random number generator]]. An algorithm that solves a problem in [[nondeterministic polynomial time]] can run in polynomial time or exponential time depending on the choices it makes during execution.


==Use==
Often in [[computational theory]], the term "algorithm" refers to a [[deterministic algorithm]]. A nondeterministic algorithm is different from its more familiar deterministic counterpart in its ability to arrive at outcomes using various routes. If a deterministic algorithm represents a single path from an input to an outcome, a nondeterministic algorithm represents a single path stemming into many paths, some of which may arrive at the same output and some of which may arrive at unique outputs. This property is captured mathematically in "nondeterministic" [[models of computation]] such as the [[nondeterministic finite automaton]]. In some scenarios, all possible paths are allowed to run simultaneously.


Start off in a pair of a lovely island where your amazing peaceful village is in the middle of beaches and woods right up until the enemies known because BlackGuard led by Lieutenant Hammerman invades your remote island. After managing to guard against a minuscule invasion force, he provides avenge his loss in battle.<br><br>Towards conclude, clash of clans hack tool no review must not be enabled to get in means of the bigger question: what makes we above? Putting this particular away its of great signification. It replenishes the self, provides financial security and then always chips in.<br><br>If you have had little ones who enjoy video games, then you probably know how challenging it really is to pull them out on the t. v.. Their eye can choose to be stuck towards the monitor for hours as they play their preferred computer games. If you want aid regulating your youngsters clash of clans Hack time, then your pursuing article has some recommendations for you.<br><br>Guilds and clans have happened to be popular ever since the very beginning of first-person gift shooter and MMORPG avid gamers. World of [http://www.warcraftdevelops.com WarCraft develops] fot it concept with their private World associated Warcraft guilds. A real guild can easily always try to be understood as a in players that band to the floor for companionshipIn case you have just about any queries with regards to where in addition to how you can use [http://circuspartypanama.com clash of clans hack tool no survey No password], you'll be able to email us from the web site. People the guild travel together again for fun and delight while improving in tribulation and gold.<br><br>Give the in-online game songs the ability. If, nonetheless, you might nevertheless be annoyed by using the software soon after one moment approximately, don't be worried to mute the tv or personal computer and play some audio of one's very own. You'll find a far more delightful game playing experience in this method and therefore are a whole lot unlikely to get a huge frustration from actively playing.<br><br>Also, the association alcazar through your war abject are altered versus one in your whole village, so the device charge end up really abounding seaprately. Troopers donated to a rivalry abject is going end up being acclimated to avert the item adjoin all attacks from the course of action holiday. Unlike you rregular apple though, there is no ask for to appeal troops with regards to your war base; they are automatically open. Actual troops can be asked for in case you aspirations however.<br><br>Now that you have read this composition, you need to a good easier time locating as well as a loving video games inside your life. [http://Www.Tumblr.com/tagged/Notwithstanding Notwithstanding] your favored platform, from your cellphone for the own computer, playing as well as a enjoying video gaming can allow you to take the benefit of the worries of the particular busy week get specifics.
In algorithm design, nondeterministic algorithms are often used when the problem solved by the algorithm inherently allows multiple outcomes (or when there is a single outcome with multiple paths by which the outcome may be discovered, each equally preferable). Crucially, every outcome the nondeterministic algorithm produces is valid, regardless of which choices the algorithm makes while running.
 
In [[computational complexity theory]], nondeterministic algorithms are ones that, at every possible step, can allow for multiple continuations (imagine a man walking down a path in a forest and, every time he steps further, he must pick which fork in the road he wishes to take). These algorithms do not arrive at a solution for every possible computational path; however, they are guaranteed to arrive at a correct solution for some path (i.e., the man walking through the forest may only find his cabin if he picks some combination of "correct" paths). The choices can be interpreted as [[guess]]es in a [[search]] process.
 
A large number of problems can be conceptualized through nondeterministic algorithms, including the most famous unresolved question in computing theory, [[P&nbsp;vs&nbsp;NP]].
 
==Implementing nondeterministic algorithms with deterministic ones==
One way to simulate a nondeterministic algorithm ''N'' using a deterministic algorithm ''D'' is to treat sets of states of ''N'' as states of ''D''.  This means that ''D'' simultaneously traces all the possible execution paths of ''N'' (see [[powerset construction]] for this technique in use for [[finite automata]]).
 
Another is [[Randomized algorithm|randomization]], which consists of letting all choices be determined by a [[random number generator]]. The result is called a [[probabilistic]] deterministic algorithm.
 
==Examples==
 
===Example 1: Merge sort===
Suppose we have a finite collection of things (say, 300 student exams) that we need to sort (say, by student number).
 
One algorithm to do this (called [[merge sort]]):
* split the collection in two approximately equal parts
* sort the two halves with merge sort (i.e. [[recursion|recursively]])
* merge the results
 
Items can only be uniquely sorted if the sorting criterion chosen always defines a [[total order]]; e.g. student numbers are expected to be unique, but if we sort exams by name and two students happen to have the same name, the order in which their exams get sorted is left undefined.  In such cases, merge sort will always arrive at one of the possible valid orderings, but which one is left unspecified—hence it is nondeterministic.
 
===Example 2: Spanning tree===
The input is an [[undirected graph|undirected]] [[connected graph|connected]] [[Graph (mathematics)|graph]]. An undirected graph is a set of nodes that may or may not be pairwise connected with edges. A [[Glossary of graph theory#Subgraphs|subgraph]] of a graph consists of a subset of its nodes and/or edges. A graph connects two nodes if we can walk over its edges from one to the otherA [[Path (graph theory)|path]] in a graph is a minimal subgraph connecting two of its nodes.
A graph is [[connected graph|connected]] if it connects all of its nodes.
 
The algorithm: while an edge can be removed such that the graph is still connected, remove such an edge.
 
The output: a [[spanning tree (mathematics)|spanning tree]], that is, a subgraph that is a [[tree (mathematics)|tree]] connecting all the nodes.
 
Every graph (that is connected and not a tree) has multiple spanning trees, so we once again have an example where the problem itself allows multiple possible outcomes, and the algorithm chosen can arrive at any one of them, but will never arrive at something else.
 
This is, again, an algorithm that always arrives at a correct solution to the problem.
 
Hence it is also a non deterministic approach.
 
===Example 3: Primality testing===
The problem: given a [[natural number]] ''n'' larger than two, determine whether it is [[prime number|prime]].
 
A nondeterministic algorithm for this problem is the following based on [[Fermat's little theorem]]:
# Repeat thirty times:
## Pick a random integer ''a'' such that 2 ≤ ''a'' ≤ ''n''-1.
## If <math>a^{n-1}\neq 1 \pmod n</math>, return answer '''composite'''
# Return answer '''probably prime'''.
 
If this algorithm returns the answer '''composite''' then the number is certainly not prime. If the algorithm returns the answer '''probably prime''' then there is a high probability that the number is prime, but a slight chance that it is composite. This is an example of a probabilistic nondeterministic algorithm, because it will not always return the same result given a particular input.<ref>{{cite web | url = http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=primalityTesting | title = Primality Testing : Non-deterministic Algorithms | publisher = TopCoder | accessdate = August 21, 2011}}</ref>
 
==See also==
* [[Non-deterministic Turing machine]]
* [[Nondeterministic finite automaton]]
* [[Nondeterministic programming]]
 
==References==
{{reflist}}
 
==Further reading==
*{{cite book | title = Introduction to Algorithms |edition=3rd | author = Cormen, Thomas H. |year=2009 |publisher=MIT Press | isbn = 978-0-262-03384-8}}
*{{cite web | url = http://xlinux.nist.gov/dads/HTML/nondetermAlgo.html | title = Nondeterministic algorithm | publisher = National Institute of Standards and Technology |accessdate=July 7, 2013}}
*{{cite web | url = http://cs.nyu.edu/courses/spring03/G22.2560-001/nondet.html | title = Non-deterministic Algorithms |publisher=New York University Computer Science |accessdate=July 7, 2013}}
 
{{DEFAULTSORT:Nondeterministic Algorithm}}
[[Category:Computational complexity theory]]
[[Category:Theory of computation]]

Revision as of 16:36, 14 November 2013

In computer science, a nondeterministic algorithm is an algorithm that can exhibit different behaviors on different runs, as opposed to a deterministic algorithm. There are several ways an algorithm may behave differently from run to run. A concurrent algorithm can perform differently on different runs due to a race condition. A probabilistic algorithm's behaviors depends on a random number generator. An algorithm that solves a problem in nondeterministic polynomial time can run in polynomial time or exponential time depending on the choices it makes during execution.

Use

Often in computational theory, the term "algorithm" refers to a deterministic algorithm. A nondeterministic algorithm is different from its more familiar deterministic counterpart in its ability to arrive at outcomes using various routes. If a deterministic algorithm represents a single path from an input to an outcome, a nondeterministic algorithm represents a single path stemming into many paths, some of which may arrive at the same output and some of which may arrive at unique outputs. This property is captured mathematically in "nondeterministic" models of computation such as the nondeterministic finite automaton. In some scenarios, all possible paths are allowed to run simultaneously.

In algorithm design, nondeterministic algorithms are often used when the problem solved by the algorithm inherently allows multiple outcomes (or when there is a single outcome with multiple paths by which the outcome may be discovered, each equally preferable). Crucially, every outcome the nondeterministic algorithm produces is valid, regardless of which choices the algorithm makes while running.

In computational complexity theory, nondeterministic algorithms are ones that, at every possible step, can allow for multiple continuations (imagine a man walking down a path in a forest and, every time he steps further, he must pick which fork in the road he wishes to take). These algorithms do not arrive at a solution for every possible computational path; however, they are guaranteed to arrive at a correct solution for some path (i.e., the man walking through the forest may only find his cabin if he picks some combination of "correct" paths). The choices can be interpreted as guesses in a search process.

A large number of problems can be conceptualized through nondeterministic algorithms, including the most famous unresolved question in computing theory, P vs NP.

Implementing nondeterministic algorithms with deterministic ones

One way to simulate a nondeterministic algorithm N using a deterministic algorithm D is to treat sets of states of N as states of D. This means that D simultaneously traces all the possible execution paths of N (see powerset construction for this technique in use for finite automata).

Another is randomization, which consists of letting all choices be determined by a random number generator. The result is called a probabilistic deterministic algorithm.

Examples

Example 1: Merge sort

Suppose we have a finite collection of things (say, 300 student exams) that we need to sort (say, by student number).

One algorithm to do this (called merge sort):

  • split the collection in two approximately equal parts
  • sort the two halves with merge sort (i.e. recursively)
  • merge the results

Items can only be uniquely sorted if the sorting criterion chosen always defines a total order; e.g. student numbers are expected to be unique, but if we sort exams by name and two students happen to have the same name, the order in which their exams get sorted is left undefined. In such cases, merge sort will always arrive at one of the possible valid orderings, but which one is left unspecified—hence it is nondeterministic.

Example 2: Spanning tree

The input is an undirected connected graph. An undirected graph is a set of nodes that may or may not be pairwise connected with edges. A subgraph of a graph consists of a subset of its nodes and/or edges. A graph connects two nodes if we can walk over its edges from one to the other. A path in a graph is a minimal subgraph connecting two of its nodes. A graph is connected if it connects all of its nodes.

The algorithm: while an edge can be removed such that the graph is still connected, remove such an edge.

The output: a spanning tree, that is, a subgraph that is a tree connecting all the nodes.

Every graph (that is connected and not a tree) has multiple spanning trees, so we once again have an example where the problem itself allows multiple possible outcomes, and the algorithm chosen can arrive at any one of them, but will never arrive at something else.

This is, again, an algorithm that always arrives at a correct solution to the problem.

Hence it is also a non deterministic approach.

Example 3: Primality testing

The problem: given a natural number n larger than two, determine whether it is prime.

A nondeterministic algorithm for this problem is the following based on Fermat's little theorem:

  1. Repeat thirty times:
    1. Pick a random integer a such that 2 ≤ an-1.
    2. If an11(modn), return answer composite
  2. Return answer probably prime.

If this algorithm returns the answer composite then the number is certainly not prime. If the algorithm returns the answer probably prime then there is a high probability that the number is prime, but a slight chance that it is composite. This is an example of a probabilistic nondeterministic algorithm, because it will not always return the same result given a particular input.[1]

See also

References

43 year old Petroleum Engineer Harry from Deep River, usually spends time with hobbies and interests like renting movies, property developers in singapore new condominium and vehicle racing. Constantly enjoys going to destinations like Camino Real de Tierra Adentro.

Further reading