Professional Documents
Culture Documents
Saurabh Upadhyay Ashish Singh Dhruv Patil Irfan Bengali
Saurabh Upadhyay Ashish Singh Dhruv Patil Irfan Bengali
PRESENTED TO:
Mrs. Twinkle Ankleshwaria
Content
~ Non-deterministic :-
An algorithm is said to be non-deterministic when there are more than one paths that algorithm
can follow.
Due to which one cannot determine which path is to be followed.
~DETERMINISTIC ~ NON-DETERMINISTIC
1 B 0 B
A A
C C
0 0
For example :- ~ Knapsack problem O(2^n/2).
3F 6 2 AC=3 E
8 2 CD=3C D
3 BE=4
AB=5
BC=6
AF=7
FC=8
BD=2
DE=2
A B
7 AC=3
F 3 2 CD=3 E
3C 2 D BE=4
AB=5
BC=6
AF=7
FC=8
Defination of NP
P - class NP - class
NP - complete NP - hard
IMPLEMENTATION
Algorithm Non_determin()
// A[1:n] is a set of elements
// We have to determine the index I of A at which element X is located.
{
// The following for loop is the guessing stage
for i=1 to n do
A[i] := choose(i);
// Next is the verification (deterministic) stage
if (A[i] = x) then
{
write(i);
success();
}
write(0);
fail();
}
Travelling Salesman Problem