/    /  DAA- Non-deterministic algorithms

Non-deterministic algorithms

 

What is a non-deterministic algorithm?

A deterministic signal gives only a single output for the same input even when it is on different runs. On the contrary, a non-deterministic algorithm gives different outputs, as it travels through different routes. 

In a situation where finding an exact solution is expensive and difficult using deterministic algorithms, non-deterministic algorithms are used. They are helpful when it comes to finding approximate solutions. 

 

A non-deterministic algorithm can run on a deterministic computer with multiple parallel processors, and usually takes two phases and output steps. The first phase is the guessing phase, and the second is the verifying phase. In the first phase, we make use of arbitrary characters to run the problem, and in verifying phase, it returns true or false values for the chosen string. An example that follows the concept of a non-deterministic algorithm is the problem of P vs NP in computing theory. They are used in solving problems that allow multiple outcomes. Every output returned is valid, irrespective of their difference in choices during the running process. 

 

Another example of the implementation of the non-deterministic algorithm is the mathematical use in computational models like a non-deterministic finite automaton. 

 

While looking at the complex computational theory, we notice that the non-deterministic have the capability to allow multiple continuations at every step. 

 

It is also widely used for game AI. It is used by the game engine to make non-player characters or referred to as NPC to learn the behavior of the game, such as the tactics and the pattern. This feature is very useful in combat games where an element of unpredictability can be added to make the game more interesting. This is done so that the scenarios are not as repetitive and the players do not get bored of it. This keeps the players hooked and hence increases the game-play life. 

 

What are the major differences between deterministic and non-deterministic algorithms?

Deterministic algorithmNon-deterministic algorithm
In a deterministic algorithm, the computer produces the same output while going through different steps. In a non-deterministic algorithm, the computer may produce different outputs for the same input while going through different runs. 
The deterministic algorithm can determine the next step. The non-deterministic algorithm cannot solve problems in polynomial time, and cannot determine the next step. 
The output is not random.The output has a certain degree of randomness to it. 
In a deterministic algorithm, the next step can be determined. In a non-deterministic algorithm, the next step cannot be determined. 

 

Non-deterministic algorithms do not have any standard programming language operators, neither they are part of any standard programming language. 

 

Reference

Non-deterministic algorithms