SlideShare a Scribd company logo
1 of 15
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

What's hot

What's hot (20)

Np cooks theorem
Np cooks theoremNp cooks theorem
Np cooks theorem
 
I.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AII.BEST FIRST SEARCH IN AI
I.BEST FIRST SEARCH IN AI
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHM
 
Depth Buffer Method
Depth Buffer MethodDepth Buffer Method
Depth Buffer Method
 
15 puzzle problem using branch and bound
15 puzzle problem using branch and bound15 puzzle problem using branch and bound
15 puzzle problem using branch and bound
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
 
K Nearest Neighbors
K Nearest NeighborsK Nearest Neighbors
K Nearest Neighbors
 
Problem solving agents
Problem solving agentsProblem solving agents
Problem solving agents
 
Issues in knowledge representation
Issues in knowledge representationIssues in knowledge representation
Issues in knowledge representation
 
Problems, Problem spaces and Search
Problems, Problem spaces and SearchProblems, Problem spaces and Search
Problems, Problem spaces and Search
 
Planning in Artificial Intelligence
Planning in Artificial IntelligencePlanning in Artificial Intelligence
Planning in Artificial Intelligence
 
First Order Logic resolution
First Order Logic resolutionFirst Order Logic resolution
First Order Logic resolution
 
Soft computing
Soft computingSoft computing
Soft computing
 
AI Lecture 7 (uncertainty)
AI Lecture 7 (uncertainty)AI Lecture 7 (uncertainty)
AI Lecture 7 (uncertainty)
 
State Space Search in ai
State Space Search in aiState Space Search in ai
State Space Search in ai
 
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptProblem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.ppt
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
 
Randomized Algorithm
Randomized AlgorithmRandomized Algorithm
Randomized Algorithm
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 

Similar to Non- Deterministic Algorithms

10 Recursion
10 Recursion10 Recursion
10 Recursionmaznabili
 
Brief introduction to Algorithm analysis
Brief introduction to Algorithm analysis Brief introduction to Algorithm analysis
Brief introduction to Algorithm analysis Anantha Ramu
 
13 recursion-120712074623-phpapp02
13 recursion-120712074623-phpapp0213 recursion-120712074623-phpapp02
13 recursion-120712074623-phpapp02Abdul Samee
 
Lecture 02: Preliminaries of Data structure
Lecture 02: Preliminaries of Data structureLecture 02: Preliminaries of Data structure
Lecture 02: Preliminaries of Data structureNurjahan Nipa
 
Java Algorithm Interview Questions & Answers .pdf
Java Algorithm Interview Questions & Answers .pdfJava Algorithm Interview Questions & Answers .pdf
Java Algorithm Interview Questions & Answers .pdfNiravPanchal50
 
Algorithms - "Chapter 2 getting started"
Algorithms - "Chapter 2 getting started"Algorithms - "Chapter 2 getting started"
Algorithms - "Chapter 2 getting started"Ra'Fat Al-Msie'deen
 
Functional Programming 101 with Scala and ZIO @FunctionalWorld
Functional Programming 101 with Scala and ZIO @FunctionalWorldFunctional Programming 101 with Scala and ZIO @FunctionalWorld
Functional Programming 101 with Scala and ZIO @FunctionalWorldJorge Vásquez
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithmspppepito86
 
Research Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and ScienceResearch Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and Scienceresearchinventy
 
Implementing an 8-chip game based on the A algorithm.pptx
Implementing an 8-chip game based on the A algorithm.pptxImplementing an 8-chip game based on the A algorithm.pptx
Implementing an 8-chip game based on the A algorithm.pptxlwz614595250
 
Lesson_8_DeepLearning.pdf
Lesson_8_DeepLearning.pdfLesson_8_DeepLearning.pdf
Lesson_8_DeepLearning.pdfssuser7f0b19
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test frameworkAbner Chih Yi Huang
 

Similar to Non- Deterministic Algorithms (20)

10. Recursion
10. Recursion10. Recursion
10. Recursion
 
Chap12alg
Chap12algChap12alg
Chap12alg
 
Chap12alg
Chap12algChap12alg
Chap12alg
 
10 Recursion
10 Recursion10 Recursion
10 Recursion
 
Brief introduction to Algorithm analysis
Brief introduction to Algorithm analysis Brief introduction to Algorithm analysis
Brief introduction to Algorithm analysis
 
13 recursion-120712074623-phpapp02
13 recursion-120712074623-phpapp0213 recursion-120712074623-phpapp02
13 recursion-120712074623-phpapp02
 
Chap06alg
Chap06algChap06alg
Chap06alg
 
Chap06alg
Chap06algChap06alg
Chap06alg
 
Lecture 02: Preliminaries of Data structure
Lecture 02: Preliminaries of Data structureLecture 02: Preliminaries of Data structure
Lecture 02: Preliminaries of Data structure
 
Java Algorithm Interview Questions & Answers .pdf
Java Algorithm Interview Questions & Answers .pdfJava Algorithm Interview Questions & Answers .pdf
Java Algorithm Interview Questions & Answers .pdf
 
Algorithms - "Chapter 2 getting started"
Algorithms - "Chapter 2 getting started"Algorithms - "Chapter 2 getting started"
Algorithms - "Chapter 2 getting started"
 
Functional Programming 101 with Scala and ZIO @FunctionalWorld
Functional Programming 101 with Scala and ZIO @FunctionalWorldFunctional Programming 101 with Scala and ZIO @FunctionalWorld
Functional Programming 101 with Scala and ZIO @FunctionalWorld
 
Chap08alg
Chap08algChap08alg
Chap08alg
 
Chap08alg
Chap08algChap08alg
Chap08alg
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
 
Matlab project
Matlab projectMatlab project
Matlab project
 
Research Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and ScienceResearch Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and Science
 
Implementing an 8-chip game based on the A algorithm.pptx
Implementing an 8-chip game based on the A algorithm.pptxImplementing an 8-chip game based on the A algorithm.pptx
Implementing an 8-chip game based on the A algorithm.pptx
 
Lesson_8_DeepLearning.pdf
Lesson_8_DeepLearning.pdfLesson_8_DeepLearning.pdf
Lesson_8_DeepLearning.pdf
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test framework
 

More from Dipankar Boruah

Employee Management System
Employee Management SystemEmployee Management System
Employee Management SystemDipankar Boruah
 
My One-Month Progress on Learning Flutter and Building.pptx
My One-Month Progress on Learning Flutter and Building.pptxMy One-Month Progress on Learning Flutter and Building.pptx
My One-Month Progress on Learning Flutter and Building.pptxDipankar Boruah
 
WiFi Communication Initial version
WiFi Communication Initial versionWiFi Communication Initial version
WiFi Communication Initial versionDipankar Boruah
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of LanguageDipankar Boruah
 

More from Dipankar Boruah (8)

Employee Management System
Employee Management SystemEmployee Management System
Employee Management System
 
COCA COLA
COCA COLACOCA COLA
COCA COLA
 
My One-Month Progress on Learning Flutter and Building.pptx
My One-Month Progress on Learning Flutter and Building.pptxMy One-Month Progress on Learning Flutter and Building.pptx
My One-Month Progress on Learning Flutter and Building.pptx
 
DATA MINING.pptx
DATA MINING.pptxDATA MINING.pptx
DATA MINING.pptx
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 
JOB PORTAL SYSTEM
JOB PORTAL SYSTEMJOB PORTAL SYSTEM
JOB PORTAL SYSTEM
 
WiFi Communication Initial version
WiFi Communication Initial versionWiFi Communication Initial version
WiFi Communication Initial version
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
 

Recently uploaded

The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 

Recently uploaded (20)

The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 

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