Non Deterministic Machine

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Basic concepts : Algorithms are divided into two types.

1. Polynomial time algorithms


2. Non Polynomial (exponential) time algorithms
O(na )
Polynomial time algorithms have time complexity
where n is the input size and a
O (log 2 (n))
O (n)
is any constant. Examples are linear search(
), binary search(
, mergesort,
O(n2 )
bubblesort(
) etc.
O (a n )
Non-Polynomial time algorithms have time complexity
where n is the input size
O (2n )
and a is any constant. Examples are travelling sales person problem(
), sum of subsets
problem, etc.
We dont require exponential (Non Polynomial) time algorithms, as they take hundreds
of years to get executed in our computer (deterministic machine).
So, we try to solve some of these exponential time algorithms in polynomial time by
using a hypothetical machine (non-deterministic machine).
Non-deterministic Algorithms
Algorithms, which use the property that the result of every operation is uniquely defined,
are termed deterministic algorithms(output is deterministic). Such algorithms agree with the way
programs are executed on a computer. Algorithms that contain operations whose outcomes are
not uniquely defined but are limited to specified sets of possibilities are called non-deterministic
algorithms(output is non deterministic). The machine executing such operations is allowed to
choose any one of these outcomes subject to a termination condition to be defined later.
New functions that are launched in non-deterministic algorithms are given below:
1
2
3

Choice(S) arbitrarily chooses one of the elements of set S.


Failure() signals an unsuccessful completion.
Success() signals a successful completion.

The assignment statement x:=Choice(1:n) could result in x being assigned any one of the
integers in the range [1,n]. There is no rule specifying how this choice is to be made. A
nondeterministic algorithm terminates unsuccessfully if and only if there exists no set of choices
leading to a success signal. That means A non-deterministic machine always tries to succeed.
The computing times for Choice, Success and Failure are taken to be O(1).
Now, we can classify algorithms as:

P : The set of all problems that are solvable by deterministic machine in polynomial time
NP: The set of all problems that are solvable by non-deterministic machine in polynomial time.
If we know, solution to an NP problem, then we can verify whether that solution is right or
wrong by using our deterministic machine in polynomial time. So, NP can also be defined as,
NP: The set of all problems that can be verified by our deterministic machine in polynomial
time.

You might also like