SlideShare a Scribd company logo
David Luebke 1 1/4/2023
CS 332: Algorithms
NP Completeness Continued
David Luebke 2 1/4/2023
Homework 5
● Extension: due midnight Monday 22 April
David Luebke 3 1/4/2023
Review: Tractibility
● Some problems are undecidable: no computer
can solve them
■ E.g., Turing’s “Halting Problem”
■ We don’t care about such problems here; take a
theory class
● Other problems are decidable, but intractable:
as they grow large, we are unable to solve
them in reasonable time
■ What constitutes “reasonable time”?
David Luebke 4 1/4/2023
Review: P
● Some problems are provably decidable in
polynomial time on an ordinary computer
■ We say such problems belong to the set P
■ Technically, a computer with unlimited memory
■ How do we typically prove a problem  P?
David Luebke 5 1/4/2023
Review: NP
● Some problems are provably decidable in
polynomial time on a nondeterministic
computer
■ We say such problems belong to the set NP
■ Can think of a nondeterministic computer as a
parallel machine that can freely spawn an infinite
number of processes
■ How do we typically prove a problem  NP?
● Is P  NP? Why or why not?
David Luebke 6 1/4/2023
Review: P And NP Summary
● P = set of problems that can be solved in
polynomial time
● NP = set of problems for which a solution can
be verified in polynomial time
● P  NP
● The big question: Does P = NP?
David Luebke 7 1/4/2023
Review: NP-Complete Problems
● The NP-Complete problems are an interesting
class of problems whose status is unknown
■ No polynomial-time algorithm has been
discovered for an NP-Complete problem
■ No suprapolynomial lower bound has been proved
for any NP-Complete problem, either
● Intuitively and informally, what does it mean
for a problem to be NP-Complete?
David Luebke 8 1/4/2023
Review: Reduction
● A problem P can be reduced to another problem
Q if any instance of P can be rephrased to an
instance of Q, the solution to which provides a
solution to the instance of P
■ This rephrasing is called a transformation
● Intuitively: If P reduces in polynomial time to
Q, P is “no harder to solve” than Q
David Luebke 9 1/4/2023
An Aside: Terminology
● What is the difference between a problem and
an instance of that problem?
● To formalize things, we will express instances
of problems as strings
■ How can we express a instance of the hamiltonian
cycle problem as a string?
● To simplify things, we will worry only about
decision problems with a yes/no answer
■ Many problems are optimization problems, but we
can often re-cast those as decision problems
David Luebke 10 1/4/2023
NP-Hard and NP-Complete
● If P is polynomial-time reducible to Q, we
denote this P p Q
● Definition of NP-Hard and NP-Complete:
■ If all problems R  NP are reducible to P, then P is
NP-Hard
■ We say P is NP-Complete if P is NP-Hard
and P  NP
■ Note: I got this slightly wrong Friday
● If P p Q and P is NP-Complete, Q is also
NP- Complete
David Luebke 11 1/4/2023
Why Prove NP-Completeness?
● Though nobody has proven that P != NP, if
you prove a problem NP-Complete, most
people accept that it is probably intractable
● Therefore it can be important to prove that a
problem is NP-Complete
■ Don’t need to come up with an efficient algorithm
■ Can instead work on approximation algorithms
David Luebke 12 1/4/2023
Proving NP-Completeness
● What steps do we have to take to prove a
problem P is NP-Complete?
■ Pick a known NP-Complete problem Q
■ Reduce Q to P
○ Describe a transformation that maps instances of Q to
instances of P, s.t. “yes” for P = “yes” for Q
○ Prove the transformation works
○ Prove it runs in polynomial time
■ Oh yeah, prove P  NP (What if you can’t?)

More Related Content

PPT
CS 332 : Algorithms - Concept of NP Completeness
PPT
lecture 28
PPT
PPT
NP-Completeewwwwwwwwwwwkkjjejjwjjjjjjjjj
PPT
PDF
P, NP, NP-Hard & NP-complete problems, Optimization
CS 332 : Algorithms - Concept of NP Completeness
lecture 28
NP-Completeewwwwwwwwwwwkkjjejjwjjjjjjjjj
P, NP, NP-Hard & NP-complete problems, Optimization

Similar to np complete.ppt (20)

PDF
NP Problems in design and analysis of alogorithm
PPT
Np completeness
PPTX
NP-Completeness-myppt.pptx
PDF
np hard, np complete, polynomial and non polynomial
PDF
Introduction
PPTX
Data structure and algorithms lecture22 presentation
PPTX
lec2cct computational cmplexity theory.pptx
PPT
UNIT-V.ppt
PDF
P versus NP
PDF
P, NP, NP-Complete, and NP-Hard
PDF
P versus NP
PDF
27 NP Completness
PPTX
P np & np completeness
PDF
Algorithm chapter 10
DOCX
PDF
UNIT -IV DAA.pdf
PPTX
Np completeness
PPTX
Design and analysis of algorithms unit 6 non deterministic polynomial
PPTX
PPT
lecture 27
NP Problems in design and analysis of alogorithm
Np completeness
NP-Completeness-myppt.pptx
np hard, np complete, polynomial and non polynomial
Introduction
Data structure and algorithms lecture22 presentation
lec2cct computational cmplexity theory.pptx
UNIT-V.ppt
P versus NP
P, NP, NP-Complete, and NP-Hard
P versus NP
27 NP Completness
P np & np completeness
Algorithm chapter 10
UNIT -IV DAA.pdf
Np completeness
Design and analysis of algorithms unit 6 non deterministic polynomial
lecture 27
Ad

More from chetanvchaudhari (8)

PPT
chapter1.ppt
PDF
auditing-190520092523.pdf
PDF
chapter2-190516054412.pdf
PPT
BranchandBoundAlgorithms[1].ppt
PPT
graph coloring.ppt
PPT
chapter16[1].ppt
PDF
M.tech computerunitwise
PDF
Format for address_change_by_mpmla_gazzeted_officer
chapter1.ppt
auditing-190520092523.pdf
chapter2-190516054412.pdf
BranchandBoundAlgorithms[1].ppt
graph coloring.ppt
chapter16[1].ppt
M.tech computerunitwise
Format for address_change_by_mpmla_gazzeted_officer
Ad

Recently uploaded (20)

PDF
Well-logging-methods_new................
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT
Project quality management in manufacturing
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
web development for engineering and engineering
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Construction Project Organization Group 2.pptx
PPTX
Welding lecture in detail for understanding
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Geodesy 1.pptx...............................................
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
additive manufacturing of ss316l using mig welding
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Well-logging-methods_new................
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Operating System & Kernel Study Guide-1 - converted.pdf
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Project quality management in manufacturing
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
CH1 Production IntroductoryConcepts.pptx
R24 SURVEYING LAB MANUAL for civil enggi
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
web development for engineering and engineering
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Construction Project Organization Group 2.pptx
Welding lecture in detail for understanding
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Embodied AI: Ushering in the Next Era of Intelligent Systems
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Geodesy 1.pptx...............................................
UNIT-1 - COAL BASED THERMAL POWER PLANTS
additive manufacturing of ss316l using mig welding
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx

np complete.ppt

  • 1. David Luebke 1 1/4/2023 CS 332: Algorithms NP Completeness Continued
  • 2. David Luebke 2 1/4/2023 Homework 5 ● Extension: due midnight Monday 22 April
  • 3. David Luebke 3 1/4/2023 Review: Tractibility ● Some problems are undecidable: no computer can solve them ■ E.g., Turing’s “Halting Problem” ■ We don’t care about such problems here; take a theory class ● Other problems are decidable, but intractable: as they grow large, we are unable to solve them in reasonable time ■ What constitutes “reasonable time”?
  • 4. David Luebke 4 1/4/2023 Review: P ● Some problems are provably decidable in polynomial time on an ordinary computer ■ We say such problems belong to the set P ■ Technically, a computer with unlimited memory ■ How do we typically prove a problem  P?
  • 5. David Luebke 5 1/4/2023 Review: NP ● Some problems are provably decidable in polynomial time on a nondeterministic computer ■ We say such problems belong to the set NP ■ Can think of a nondeterministic computer as a parallel machine that can freely spawn an infinite number of processes ■ How do we typically prove a problem  NP? ● Is P  NP? Why or why not?
  • 6. David Luebke 6 1/4/2023 Review: P And NP Summary ● P = set of problems that can be solved in polynomial time ● NP = set of problems for which a solution can be verified in polynomial time ● P  NP ● The big question: Does P = NP?
  • 7. David Luebke 7 1/4/2023 Review: NP-Complete Problems ● The NP-Complete problems are an interesting class of problems whose status is unknown ■ No polynomial-time algorithm has been discovered for an NP-Complete problem ■ No suprapolynomial lower bound has been proved for any NP-Complete problem, either ● Intuitively and informally, what does it mean for a problem to be NP-Complete?
  • 8. David Luebke 8 1/4/2023 Review: Reduction ● A problem P can be reduced to another problem Q if any instance of P can be rephrased to an instance of Q, the solution to which provides a solution to the instance of P ■ This rephrasing is called a transformation ● Intuitively: If P reduces in polynomial time to Q, P is “no harder to solve” than Q
  • 9. David Luebke 9 1/4/2023 An Aside: Terminology ● What is the difference between a problem and an instance of that problem? ● To formalize things, we will express instances of problems as strings ■ How can we express a instance of the hamiltonian cycle problem as a string? ● To simplify things, we will worry only about decision problems with a yes/no answer ■ Many problems are optimization problems, but we can often re-cast those as decision problems
  • 10. David Luebke 10 1/4/2023 NP-Hard and NP-Complete ● If P is polynomial-time reducible to Q, we denote this P p Q ● Definition of NP-Hard and NP-Complete: ■ If all problems R  NP are reducible to P, then P is NP-Hard ■ We say P is NP-Complete if P is NP-Hard and P  NP ■ Note: I got this slightly wrong Friday ● If P p Q and P is NP-Complete, Q is also NP- Complete
  • 11. David Luebke 11 1/4/2023 Why Prove NP-Completeness? ● Though nobody has proven that P != NP, if you prove a problem NP-Complete, most people accept that it is probably intractable ● Therefore it can be important to prove that a problem is NP-Complete ■ Don’t need to come up with an efficient algorithm ■ Can instead work on approximation algorithms
  • 12. David Luebke 12 1/4/2023 Proving NP-Completeness ● What steps do we have to take to prove a problem P is NP-Complete? ■ Pick a known NP-Complete problem Q ■ Reduce Q to P ○ Describe a transformation that maps instances of Q to instances of P, s.t. “yes” for P = “yes” for Q ○ Prove the transformation works ○ Prove it runs in polynomial time ■ Oh yeah, prove P  NP (What if you can’t?)