SlideShare a Scribd company logo
5
Most read
10
Most read
11
Most read
Non-Deterministic
Algorithms
Name: Dipankar Boruah
Roll no: MCA/21/24
Content:
 Introduction
 Deterministic algorithm
 Non-deterministic algorithm
 Stages of Non-deterministic algorithm
 Non-deterministic Search Algorithm
 Non-deterministic Sorting Algorithm
 Functions used in the Algorithm
Introduction
 Two types of algorithm: Deterministic and Non-deterministic.
 An algorithm which provides different output for same input is a non-
deterministic algorithm.
Deterministic Algorithm:
 Particular input will always produce the same output.
 Purely determines its input where no randomness is involve.
 It is uniquely defined without any ambiguity.
 Has predefined output.
q0
q1
q2
0
1
Fig:1
Non-deterministic Algorithm
 May not have unique results.
 There can be specific set of possibilities for each operation.
 It is a two stage algorithm (Guessing and Verification).
 No particular rule is followed here to make the guess.
q0
q1
q2
q3
0
0
0
Fig:2
Stages of Non-deterministic algorithm
 Non-deterministic Stage or guessing stage.
 Deterministic Stage or verification stage.
Non-deterministic Stage(Guessing stage)
 Here it generate an arbitrary string that can be thought of as a candidate
solution.
Deterministic Stage(Verification stage)
 In this stage we take candidate solution and instance of the problem as the
input.
 It returns yes if the candidate represent the actual solution(if the guessing is
correct).
 If the answer is no our guessing is wrong.
Non-deterministic Algorithm
 A Non-deterministic Algorithm terminates if and only if there exist no set of
choices leading to a successful signal.
 A machine that is capable of executing a Non-deterministic Algorithm is called
as Non-deterministic machine, Non-deterministic finite automata(NFA).
Non-deterministic Search Algorithm
No looping so, complexity = O(1)
Searching x on A[1:n], on success returns j if A[j]=x or return 0 otherwise
j = choice(1,n); //j will return a arbitrary value form 1 to n
if (A[j]==x) then {write(j); success();} /*if we find the search item x in jth location
then write() will write the value of j in
output and success() will indicate
successful completion.*/
write(0); Failure(); //will indicate failure
Non-deterministic Sorting Algorithm
No nested loops so, complexity = O(n)
Sorting array A[1:n] of positive integers in ascending order
Algorithm Nsort(A,n) //sort n positive integers.
{
for i =1 to n do B[i]=0; //Initialize B[] with all location 0
for i = 1 to n do //Searching in the main array
{
j = choice(1,n); //j will return a value form 1 to n
if(B[j]!=0)then failure();
B[j] = A[i]; //Taking a value from A[i] and putting it in B[j]th location
}
for i=1 to (n-1)do //verify order
if (B[i]>B[i+1]) then failure(); //if the items are not in ascending order will fail
write(B[1:n]); //will print the sorted array
success(); //indicate successful termination.
}
Functions used in the Algorithm
 Choice(s)- it randomly chooses one of the elements of set(s)
 Failure()- it signals an unsuccessful completion.
 Success()- it signals a successful completion.
Uses
 In a Np-problem the algorithm having non-polynomial time complexity, by
applying non-deterministic algorithm on them, the complexity might get
reduce and it can come to polynomial time.
Reference:
 https://www.techopedia.com/definition/18830/deterministic-algorithm
 https://www.geeksforgeeks.org/difference-between-deterministic-and-non-
deterministic-algorithms
 https://en.wikipedia.org/wiki/Nondeterministic_algorithm
 https://www.youtube.com/watch?v=ZNe1ziMExGg
 https://www.tutorialspoint.com/difference-between-deterministic-and-non-
deterministic-algorithms
THANK YOU

More Related Content

PPT
Sorting algorithms
PPT
Introduction to Design Algorithm And Analysis.ppt
PPT
Lower bound
PDF
9. chapter 8 np hard and np complete problems
PPT
Introduction to Data Structures Sorting and searching
PDF
DAA Notes.pdf
PPTX
Back tracking and branch and bound class 20
PPT
Time andspacecomplexity
Sorting algorithms
Introduction to Design Algorithm And Analysis.ppt
Lower bound
9. chapter 8 np hard and np complete problems
Introduction to Data Structures Sorting and searching
DAA Notes.pdf
Back tracking and branch and bound class 20
Time andspacecomplexity

What's hot (20)

PPTX
Three Address code
PPTX
Performance analysis(Time & Space Complexity)
PPTX
Sum of subset problem.pptx
PPTX
Greedy Algorithm - Knapsack Problem
PDF
I.BEST FIRST SEARCH IN AI
PPTX
Webinar : P, NP, NP-Hard , NP - Complete problems
PPTX
sum of subset problem using Backtracking
PDF
Daa notes 1
PDF
I.ITERATIVE DEEPENING DEPTH FIRST SEARCH(ID-DFS) II.INFORMED SEARCH IN ARTIFI...
PDF
P, NP, NP-Complete, and NP-Hard
PPTX
Recognition-of-tokens
PPTX
Input-Buffering
DOC
Time and space complexity
PPTX
Chess board problem(divide and conquer)
PPT
Sum of subsets problem by backtracking 
PPT
Time complexity
PPTX
CLR AND LALR PARSER
PPTX
And or graph
PPTX
0 1 knapsack using branch and bound
PPTX
Planning in AI(Partial order planning)
Three Address code
Performance analysis(Time & Space Complexity)
Sum of subset problem.pptx
Greedy Algorithm - Knapsack Problem
I.BEST FIRST SEARCH IN AI
Webinar : P, NP, NP-Hard , NP - Complete problems
sum of subset problem using Backtracking
Daa notes 1
I.ITERATIVE DEEPENING DEPTH FIRST SEARCH(ID-DFS) II.INFORMED SEARCH IN ARTIFI...
P, NP, NP-Complete, and NP-Hard
Recognition-of-tokens
Input-Buffering
Time and space complexity
Chess board problem(divide and conquer)
Sum of subsets problem by backtracking 
Time complexity
CLR AND LALR PARSER
And or graph
0 1 knapsack using branch and bound
Planning in AI(Partial order planning)
Ad

Similar to Non- Deterministic Algorithms (20)

PPT
Algorithm Design and Analysis
PPT
Introduction
PPTX
Unit 1.pptx
PDF
Binary Sort
RTF
Design and Analysis of algorithms
PPTX
Randomized Algorithm- Advanced Algorithm
PDF
Study on Sorting Algorithm and Position Determining Sort
RTF
algorithm unit 1
PDF
01-Slides.pdf
PDF
Algorithms
PDF
Quick sort,bubble sort,heap sort and merge sort
PDF
Design and analysis of algorithm final course
PDF
Data structures and algorithms
PPTX
ADA_Module 2_MN.pptx Analysis and Design of Algorithms
PPTX
Lower bound theory Np hard & Np completeness
PDF
An efficient sorting algorithm increcomparision sort
PDF
An efficient sorting algorithm increcomparision sort 2
PDF
jn;lm;lkm';m';;lmppt of data structure.pdf
PDF
Iare ds ppt_3
Algorithm Design and Analysis
Introduction
Unit 1.pptx
Binary Sort
Design and Analysis of algorithms
Randomized Algorithm- Advanced Algorithm
Study on Sorting Algorithm and Position Determining Sort
algorithm unit 1
01-Slides.pdf
Algorithms
Quick sort,bubble sort,heap sort and merge sort
Design and analysis of algorithm final course
Data structures and algorithms
ADA_Module 2_MN.pptx Analysis and Design of Algorithms
Lower bound theory Np hard & Np completeness
An efficient sorting algorithm increcomparision sort
An efficient sorting algorithm increcomparision sort 2
jn;lm;lkm';m';;lmppt of data structure.pdf
Iare ds ppt_3
Ad

More from Dipankar Boruah (8)

PPTX
Employee Management System
PDF
COCA COLA
PPTX
My One-Month Progress on Learning Flutter and Building.pptx
PPTX
DATA MINING.pptx
PPTX
Cloud Computing
PDF
JOB PORTAL SYSTEM
PDF
WiFi Communication Initial version
PPTX
Chomsky classification of Language
Employee Management System
COCA COLA
My One-Month Progress on Learning Flutter and Building.pptx
DATA MINING.pptx
Cloud Computing
JOB PORTAL SYSTEM
WiFi Communication Initial version
Chomsky classification of Language

Recently uploaded (20)

PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Geodesy 1.pptx...............................................
PPT
Project quality management in manufacturing
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
Well-logging-methods_new................
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
PPT on Performance Review to get promotions
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
R24 SURVEYING LAB MANUAL for civil enggi
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Geodesy 1.pptx...............................................
Project quality management in manufacturing
Automation-in-Manufacturing-Chapter-Introduction.pdf
Embodied AI: Ushering in the Next Era of Intelligent Systems
Well-logging-methods_new................
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Internet of Things (IOT) - A guide to understanding
Operating System & Kernel Study Guide-1 - converted.pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPT on Performance Review to get promotions
Model Code of Practice - Construction Work - 21102022 .pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...

Non- Deterministic Algorithms

  • 2. Content:  Introduction  Deterministic algorithm  Non-deterministic algorithm  Stages of Non-deterministic algorithm  Non-deterministic Search Algorithm  Non-deterministic Sorting Algorithm  Functions used in the Algorithm
  • 3. Introduction  Two types of algorithm: Deterministic and Non-deterministic.  An algorithm which provides different output for same input is a non- deterministic algorithm.
  • 4. Deterministic Algorithm:  Particular input will always produce the same output.  Purely determines its input where no randomness is involve.  It is uniquely defined without any ambiguity.  Has predefined output. q0 q1 q2 0 1 Fig:1
  • 5. Non-deterministic Algorithm  May not have unique results.  There can be specific set of possibilities for each operation.  It is a two stage algorithm (Guessing and Verification).  No particular rule is followed here to make the guess. q0 q1 q2 q3 0 0 0 Fig:2
  • 6. Stages of Non-deterministic algorithm  Non-deterministic Stage or guessing stage.  Deterministic Stage or verification stage.
  • 7. Non-deterministic Stage(Guessing stage)  Here it generate an arbitrary string that can be thought of as a candidate solution.
  • 8. Deterministic Stage(Verification stage)  In this stage we take candidate solution and instance of the problem as the input.  It returns yes if the candidate represent the actual solution(if the guessing is correct).  If the answer is no our guessing is wrong.
  • 9. Non-deterministic Algorithm  A Non-deterministic Algorithm terminates if and only if there exist no set of choices leading to a successful signal.  A machine that is capable of executing a Non-deterministic Algorithm is called as Non-deterministic machine, Non-deterministic finite automata(NFA).
  • 10. Non-deterministic Search Algorithm No looping so, complexity = O(1) Searching x on A[1:n], on success returns j if A[j]=x or return 0 otherwise j = choice(1,n); //j will return a arbitrary value form 1 to n if (A[j]==x) then {write(j); success();} /*if we find the search item x in jth location then write() will write the value of j in output and success() will indicate successful completion.*/ write(0); Failure(); //will indicate failure
  • 11. Non-deterministic Sorting Algorithm No nested loops so, complexity = O(n) Sorting array A[1:n] of positive integers in ascending order Algorithm Nsort(A,n) //sort n positive integers. { for i =1 to n do B[i]=0; //Initialize B[] with all location 0 for i = 1 to n do //Searching in the main array { j = choice(1,n); //j will return a value form 1 to n if(B[j]!=0)then failure(); B[j] = A[i]; //Taking a value from A[i] and putting it in B[j]th location } for i=1 to (n-1)do //verify order if (B[i]>B[i+1]) then failure(); //if the items are not in ascending order will fail write(B[1:n]); //will print the sorted array success(); //indicate successful termination. }
  • 12. Functions used in the Algorithm  Choice(s)- it randomly chooses one of the elements of set(s)  Failure()- it signals an unsuccessful completion.  Success()- it signals a successful completion.
  • 13. Uses  In a Np-problem the algorithm having non-polynomial time complexity, by applying non-deterministic algorithm on them, the complexity might get reduce and it can come to polynomial time.
  • 14. Reference:  https://www.techopedia.com/definition/18830/deterministic-algorithm  https://www.geeksforgeeks.org/difference-between-deterministic-and-non- deterministic-algorithms  https://en.wikipedia.org/wiki/Nondeterministic_algorithm  https://www.youtube.com/watch?v=ZNe1ziMExGg  https://www.tutorialspoint.com/difference-between-deterministic-and-non- deterministic-algorithms