I do not the understand the concept of Non Deterministic Turing Machine. I guess I understand the term Non deterministic algorithm : (nondeterministic algorithm is an algorithm that can exhibit different behaviors on different runs, as opposed to a deterministic algorithm.) So the algorithm could be like :
a = fromSomeAlgo();
if(a > foo)
stateA();
else
stateB();
But for non-deterministic turing machine I read , it can be in more than one state at a given time. Also a wikipedia article suggests "A non-deterministic Turing machine (NTM), may have a set of rules that prescribes more than one action for a given situation".
What does that mean ? ..More than one action for a given stituation...multiple states... I simply do not understand this.
In a Non Deterministic Turing machine, in each branch - you do both possibilities - and only when you are done you "choose" which one is the one you need for the solution (if one exists).
For example, let's look at the subset sum problem, with S = {a,b,c... }
. The Non Deterministic Turing machine has a linear solution:
for each element:
"guess" if it is in the subset
check if the subset has the specified sum
The tree generated will be something like that:
start
with a without a
/ \ / \
/ \ / \
/ \ / \
with b without b with b without b
/ \ / \ / \ / \
with c without c with c without c with c without c with c without c
It is enough that one calculation (path in the tree) is correct in order for the algorithm to yield "true". It yields "false" only if there is no such calculation.
The concept of Non Deterministic Turing Machine is purely theoretical - there is no non-deterministic turing machine available.
Bonus:
Note that everything that can be done with Non Deterministic Turing Machine - can be done with a Deterministic Turing Machine (and vise versa) - for example, the Halting Problem is not decideable in either. However, NPC problems can be done polynomially in Non Deterministic Turing Machines, and we do not know (and we assume we cannot) how to do it polynomially on Deterministic Turing Machines.