SlideShare a Scribd company logo
1 of 16
Download to read offline
Complexity Theory
Prof. Shashikant V. Athawale
Assistant Professor | Computer Engineering
Department | AISSMS College of Engineering,
Kennedy Road, Pune , MH, India - 411001
CONTENTS
1. Asymptotic notation
2. Deterministic Algorithm
3. Non-Deterministic Algorithm
4. Difference between Deterministic Algorithm & Non-Deterministic Algorithm
5. P problems
6. NP problems
7. Difference between P and NP problems
8. 3-Satisfiability
9. Hamiltonian Cycle
Asymptotic notation
• Big Theta (T)
• Big Oh(O)
• Big Omega ()
• The Big O notation defines an upper bound of an algorithm, it bounds
a function only from above. For example, consider the case of
Insertion Sort.
• g(n) is upper bound of the f(n) if there is exists some positive
constants c and n0.It is denoted as f(n)=O(g(n)).
• The Big Omega notation defines an lower bound of an algorithm.
• Running time of the algorithem cannot be less than asymptotic lower
bound for sequence of the data.
• Big Theta defines the tight bound for the algorithem.
• Running time of the algorithem cannot be less than or greater than its
asymptotic tight bound for random sequence of the data.
DETERMINISTIC ALGORITHM
• In Deteministic algorithem For a particular input the computer will give same
output every time.
• examples are finding odd or even,sorting,finding max etc.
• Most of the algorithem are deterministic in nature.
NON-DETERMINISTIC ALGORITHM
• In non deterministic algorithem for a same input the computer will
give different output on different execution.
• This algorithem operates in two phases Guessing and Verification.
• Randomly picking some elements from the list and check if it is
maximum is non-deterministic.
Difference between Deterministic and Non-
deterministic Algorithms
Deterministic Algorithm
• For a particular input the computer will give different output on different
execution.
• Can solve the problem in polynomial time.
Non-deterministic Algorithm
• For a particular input the computer will give different output on different
execution.
• Can’t solve the problem in polynomial time.
P and NP class
Problem
P class NP class
NP Complete NP hard
P-Class Problem
• The class P consists of those problems that are solvable in polynomial
time, i.e. these problems can be solved in time O(nk) in worst-case,
where k is constant.
• These problems are called tractable, while others are called
intractable or super polynomial.
• The advantages in considering the class of polynomial-time
algorithms is that all reasonable deterministic single processor model
of computation can be simulated on each other with at most a
polynomial slow-d
NP-Class Problem
• The class NP consists of those problems that are verifiable in
polynomial time. NP is the class of decision problems for which it is
easy to check the correctness of a claimed answer, with the aid of a
little extra information.
• Every problem in this class can be solved in exponential time using
exhaustive search.
Difference between P and NP class problem
• All problems in P can be solved with polynomial time algorithms,
whereas all problems in NP - P are intractable.
• P is set of problems that can be solved by a deterministic Turing
machine in Polynomial time.
• NP is set of decision problems that can be solved by a Non-
deterministic Turing Machine in Polynomial time.
• NP-complete problems are the hardest problems in NP set.
NP-complete problems
A decision problem L is NP-complete if:
1) L is in NP (Any given solution for NP-complete problems can be
verified quickly, but there is no efficient known solution).
2) Every problem in NP is reducible to L in polynomial time (Reduction
is defined below).
A problem is NP-Hard if it follows property 2 mentioned above, doesn’t
need to follow property 1. Therefore, NP-Complete set is also a subset
of NP-Hard set.
Examples:
• Knapsack problem
• Hamiltonian path problem
• vertex cover problem
• Boolen satisfiabiltiy problem
• clique problem
3-Satisfiability
• Satisfiability's role as the first NP-complete problem implies that the problem
is hard to solve in the worst case, but certain instances of the problem are not
necessarily so tough. .
• Input: A collection of clauses C where each clause contains exactly 3 literals,
over a set of Boolean variables V.
• Output: Is there a truth assignment to V such that each clause is satisfied?
Since this is a more restricted problem than satisfiablity, the hardness of 3-SAT
implies that satisfiability is hard. The converse isn't true, as the hardness of
general satisfiability might depend upon having long clauses. We can show the
hardness of 3-SAT using a reduction that translates every instance of
satisfiability into an instance of 3-S.
Hamiltonian Cycle
Hamiltonian Path in an undirected graph is a path that visits each
vertex exactly once.
A Hamiltonian cycle (or Hamiltonian circuit) is a Hamiltonian Path
such that there is an edge (in the graph) from the last vertex to the
first vertex of the Hamiltonian Path.
Thank you

More Related Content

Similar to teteuueieoeofhfhfjffkkkfkfflflflhshssnnvmvvmvv,v,v,nnxmxxm

Proving Lower Bounds to Answer the P versus NP question
Proving Lower Bounds to Answer the P versus NP questionProving Lower Bounds to Answer the P versus NP question
Proving Lower Bounds to Answer the P versus NP questionguest577718
 
Np Completeness
Np CompletenessNp Completeness
Np CompletenessRajan Shah
 
Algorithm chapter 10
Algorithm chapter 10Algorithm chapter 10
Algorithm chapter 10chidabdu
 
Proving Lower Bounds to Answer the P versus NP Problem
Proving Lower Bounds to Answer the P versus NP ProblemProving Lower Bounds to Answer the P versus NP Problem
Proving Lower Bounds to Answer the P versus NP Problemguest577718
 
Bt0080 fundamentals of algorithms2
Bt0080 fundamentals of algorithms2Bt0080 fundamentals of algorithms2
Bt0080 fundamentals of algorithms2Techglyphs
 
2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練Abner Huang
 
P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardAnimesh Chaturvedi
 
Webinar : P, NP, NP-Hard , NP - Complete problems
Webinar : P, NP, NP-Hard , NP - Complete problems Webinar : P, NP, NP-Hard , NP - Complete problems
Webinar : P, NP, NP-Hard , NP - Complete problems Ziyauddin Shaik
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexityAnkit Katiyar
 
Np completeness h4
Np completeness  h4Np completeness  h4
Np completeness h4Rajendran
 
Proving Lower Bounds to answer the P versus NP Question
Proving Lower Bounds to answer the P versus NP QuestionProving Lower Bounds to answer the P versus NP Question
Proving Lower Bounds to answer the P versus NP Questionguest383ed6
 

Similar to teteuueieoeofhfhfjffkkkfkfflflflhshssnnvmvvmvv,v,v,nnxmxxm (20)

DAA.pdf
DAA.pdfDAA.pdf
DAA.pdf
 
UNIT-V.ppt
UNIT-V.pptUNIT-V.ppt
UNIT-V.ppt
 
Unit 5
Unit 5Unit 5
Unit 5
 
Unit 5
Unit 5Unit 5
Unit 5
 
Np complete
Np completeNp complete
Np complete
 
Proving Lower Bounds to Answer the P versus NP question
Proving Lower Bounds to Answer the P versus NP questionProving Lower Bounds to Answer the P versus NP question
Proving Lower Bounds to Answer the P versus NP question
 
Np Completeness
Np CompletenessNp Completeness
Np Completeness
 
Algorithm chapter 10
Algorithm chapter 10Algorithm chapter 10
Algorithm chapter 10
 
Proving Lower Bounds to Answer the P versus NP Problem
Proving Lower Bounds to Answer the P versus NP ProblemProving Lower Bounds to Answer the P versus NP Problem
Proving Lower Bounds to Answer the P versus NP Problem
 
class23.ppt
class23.pptclass23.ppt
class23.ppt
 
Np complete
Np completeNp complete
Np complete
 
Bt0080 fundamentals of algorithms2
Bt0080 fundamentals of algorithms2Bt0080 fundamentals of algorithms2
Bt0080 fundamentals of algorithms2
 
2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練
 
P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-Hard
 
Webinar : P, NP, NP-Hard , NP - Complete problems
Webinar : P, NP, NP-Hard , NP - Complete problems Webinar : P, NP, NP-Hard , NP - Complete problems
Webinar : P, NP, NP-Hard , NP - Complete problems
 
np complete
np completenp complete
np complete
 
NP completeness
NP completenessNP completeness
NP completeness
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
 
Np completeness h4
Np completeness  h4Np completeness  h4
Np completeness h4
 
Proving Lower Bounds to answer the P versus NP Question
Proving Lower Bounds to answer the P versus NP QuestionProving Lower Bounds to answer the P versus NP Question
Proving Lower Bounds to answer the P versus NP Question
 

Recently uploaded

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

teteuueieoeofhfhfjffkkkfkfflflflhshssnnvmvvmvv,v,v,nnxmxxm

  • 1. Complexity Theory Prof. Shashikant V. Athawale Assistant Professor | Computer Engineering Department | AISSMS College of Engineering, Kennedy Road, Pune , MH, India - 411001
  • 2. CONTENTS 1. Asymptotic notation 2. Deterministic Algorithm 3. Non-Deterministic Algorithm 4. Difference between Deterministic Algorithm & Non-Deterministic Algorithm 5. P problems 6. NP problems 7. Difference between P and NP problems 8. 3-Satisfiability 9. Hamiltonian Cycle
  • 3. Asymptotic notation • Big Theta (T) • Big Oh(O) • Big Omega ()
  • 4. • The Big O notation defines an upper bound of an algorithm, it bounds a function only from above. For example, consider the case of Insertion Sort. • g(n) is upper bound of the f(n) if there is exists some positive constants c and n0.It is denoted as f(n)=O(g(n)). • The Big Omega notation defines an lower bound of an algorithm. • Running time of the algorithem cannot be less than asymptotic lower bound for sequence of the data. • Big Theta defines the tight bound for the algorithem. • Running time of the algorithem cannot be less than or greater than its asymptotic tight bound for random sequence of the data.
  • 5. DETERMINISTIC ALGORITHM • In Deteministic algorithem For a particular input the computer will give same output every time. • examples are finding odd or even,sorting,finding max etc. • Most of the algorithem are deterministic in nature.
  • 6. NON-DETERMINISTIC ALGORITHM • In non deterministic algorithem for a same input the computer will give different output on different execution. • This algorithem operates in two phases Guessing and Verification. • Randomly picking some elements from the list and check if it is maximum is non-deterministic.
  • 7. Difference between Deterministic and Non- deterministic Algorithms Deterministic Algorithm • For a particular input the computer will give different output on different execution. • Can solve the problem in polynomial time. Non-deterministic Algorithm • For a particular input the computer will give different output on different execution. • Can’t solve the problem in polynomial time.
  • 8. P and NP class Problem P class NP class NP Complete NP hard
  • 9. P-Class Problem • The class P consists of those problems that are solvable in polynomial time, i.e. these problems can be solved in time O(nk) in worst-case, where k is constant. • These problems are called tractable, while others are called intractable or super polynomial. • The advantages in considering the class of polynomial-time algorithms is that all reasonable deterministic single processor model of computation can be simulated on each other with at most a polynomial slow-d
  • 10. NP-Class Problem • The class NP consists of those problems that are verifiable in polynomial time. NP is the class of decision problems for which it is easy to check the correctness of a claimed answer, with the aid of a little extra information. • Every problem in this class can be solved in exponential time using exhaustive search.
  • 11. Difference between P and NP class problem • All problems in P can be solved with polynomial time algorithms, whereas all problems in NP - P are intractable. • P is set of problems that can be solved by a deterministic Turing machine in Polynomial time. • NP is set of decision problems that can be solved by a Non- deterministic Turing Machine in Polynomial time. • NP-complete problems are the hardest problems in NP set.
  • 12. NP-complete problems A decision problem L is NP-complete if: 1) L is in NP (Any given solution for NP-complete problems can be verified quickly, but there is no efficient known solution). 2) Every problem in NP is reducible to L in polynomial time (Reduction is defined below). A problem is NP-Hard if it follows property 2 mentioned above, doesn’t need to follow property 1. Therefore, NP-Complete set is also a subset of NP-Hard set.
  • 13. Examples: • Knapsack problem • Hamiltonian path problem • vertex cover problem • Boolen satisfiabiltiy problem • clique problem
  • 14. 3-Satisfiability • Satisfiability's role as the first NP-complete problem implies that the problem is hard to solve in the worst case, but certain instances of the problem are not necessarily so tough. . • Input: A collection of clauses C where each clause contains exactly 3 literals, over a set of Boolean variables V. • Output: Is there a truth assignment to V such that each clause is satisfied? Since this is a more restricted problem than satisfiablity, the hardness of 3-SAT implies that satisfiability is hard. The converse isn't true, as the hardness of general satisfiability might depend upon having long clauses. We can show the hardness of 3-SAT using a reduction that translates every instance of satisfiability into an instance of 3-S.
  • 15. Hamiltonian Cycle Hamiltonian Path in an undirected graph is a path that visits each vertex exactly once. A Hamiltonian cycle (or Hamiltonian circuit) is a Hamiltonian Path such that there is an edge (in the graph) from the last vertex to the first vertex of the Hamiltonian Path.