SlideShare a Scribd company logo
1
NP-Completeness
November 28, 2003
Young Eun Kim and Gene Moo Lee
Department of Computer Science & Engineering
Korea University
2/30
Contents
• Introduction and Motivation
• Background Knowledge
• Definition of NP-Completeness
• Examples of NP-Complete Problems
• Hierarchy of Problems
• How to Prove NP-Completeness
• How to Cope with NP-Complete Problems
• Conclusion
3/30
Introduction (1/2)
• Some Algorithms we’ve seen in this class
– Sorting – O(N log N)
– Searching – O(log N)
– Shortest Path Finding – O(N2
)
• However, some problems only have
– Exponential Time Algorithm O(2N
)
– So What?
Why? What? How?
4/30
Introduction (2/2)
N 10 20 30 40 50 60
O(N) .00001
second
.00002
second
.00003
second
.00004
second
.00005
second
.00006
second
O(N2
) .0001
second
.0004
second
.0009
second
.0016
second
.0025
second
.0036
second
O(N3
) .001
second
.008
second
.027
second
.064
second
.125
second
.216
second
O(N5
) 1
second
3.2
seconds
24.3
seconds
1.7
minutes
5.2
minutes
13.0
minutes
O(2N
) .001
second
1.0
second
17.9
minutes
12.7
days
35.7
years
366
centuries
O(3N
) .059
second
58
minutes
6.5
years
3855
centuries
2*108
centuries
1013
centuries
Why? What? How?
5/30
Motivation
• Traveling Salesman Problem (n = 1000)
• Compute 1000!
– Even Electron in the Universe is a Super Computer,
– And they work for the Estimated Life of the Universe,
– WE CANNOT SOLVE THIS PROBLEM!!!
– This kind of problems are NP-Complete.
Why? What? How?
6/30
Background Knowledge
To understand NP-Completeness, need to
know these concepts
1. Decision and Optimization Problems
2. Turing Machine and class P
3. Nondeterminism and class NP
4. Polynomial Time Reduction
(Problem Transformation)
Why? What? How?
7/30
Decision and Optimization Problems
• What is the Shortest Path from A to B?
– This is an Optimization Problem.
• Is there a Path from A to B consisting of at
most K edges?
– This is the related Decision Problem.
We consider only Decision Problems!
Why? What? How?
8/30
Turing Machine and Class P
(1/3)
Church – Turing Thesis
“Computer ≡ Turing Machine”
Alan Turing(1912-1954)
(www.time.com)
Why? What? How?
9/30
Turing Machine and Class P
(2/3)
A Turing machine
is a 7-tuple (Q, ∑, Γ, δ, q0, qaccept, qreject).
Why? What? How?
10/30
Turing Machine and Class P
(3/3)
P : the class of problems that are
decidable in polynomial time on a
Turing machine
Sorting, Shortest Path are in P!
Why? What? How?
11/30
Nondeterminism and Class NP (1/2)
• A Nondeterministic Turing machine is a Turing
machine with the transition function has the form
δ : Q * Γ  P(Q * Γ * {L, R}).
• NTM guess to choose the answer nondeterministically
Why? What? How?
12/30
Nondeterminism and Class NP (2/2)
• NP : the class of problems that are decidable in
polynomial time on a nondeterministic Turing
machine
• Solutions of problems in NP can be checked
(verified) in polynomial time.
• If a Hamiltonian path were discovered somehow,
we could easily check if the path is Hamiltonian.
– HAMPATH is in NP! Also Sorting is in NP!
Why? What? How?
13/30
Class P and NP
• P = the class of problems where
membership can be decided quickly.
• NP = the class of problems where
membership can be verified quickly.
Why? What? How?
14/30
Polynomial Time Reduction
Traveling Salesman Problem5-CliqueMap Coloring
Traveling Salesman Problem
 5-Clique  Map Coloring
Why? What? How?
15/30
Definition of NP-Completeness
A problem B is NP-complete
if it satisfies two conditions:
1. B is in NP, and
2. Every problem A in NP is polynomial
time reducible to B. (NP-Hard)
Why? What? How?
16/30
Meaning of NP-Completeness
• NP: Nondeterministic Polynomial
• Complete:
– If one of the problems in NPC have an
efficient algorithm, then all the problems
in NP have efficient algorithms.
Why? What? How?
17/30
Examples of NP-Completeness
• Satisfiability (SAT)
• Traveling Salesman Problem (TSP)
• Longest Path (vs. Shortest Path is in P)
• Real-Time Scheduling
• Hamiltonian Path (vs. Euler Path is in P)
Why? What? How?
18/30
Where are we?
Background Knowledge
Definition of NP-Completeness
Examples of NP-Complete Problems
• Hierarchy of Problems
• How to Prove NP-Completeness
• How to Cope with NP-Completeness
19/30
Hierarchy of Problems (1/2)
P NP PSPACE = NPSPACE EXPTIME⊆ ⊆ ⊆
Conjectured Relationships
EXPTIME
NPSPACE
NP P
UNDECIDABLE
Why? What? How?
20/30
Hierarchy of Problems (2/2)
NP
P
Which one is correct?
An efficient algorithm on a
deterministic machine does not
exist.
An efficient algorithm on a
deterministic machine is not
found yet.
P = NP
Why? What? How?
21/30
How to prove NP-Completeness(1/3)
• If B is NP-complete and B C for C in NP,∝
then C is NP-complete.
B C
NP-complete NP-complete
Then, we need at least one NP-complete problem!
Why? What? How?
22/30
How to prove NP-Completeness(2/3)
Cook’s Theorem
“Satisfiability Problem (SAT) is
NP-complete.”
- the first NP-complete
problem!
Stephen Cook
(www.cs.toronto.edu)
Why? What? How?
23/30
I’m also NP
Complete!
How to prove NP-Completeness(3/3)
any NP
problem
can be reduced to...
SAT
new NP
problem
can be reduced to...
Proved by
Cook
New Problem
is “no easier”
than SAT
Why? What? How?
24/30
NP-Complete Problems Tree
SAT
3-SAT Graph 3-Color
3-DM
Exact Cover Planer 3-color
Vertex Cover
Subset-Sum
HAMPATH Clique
Partition
Integer
Programming
IndependentTSP (Salesman)
Why? What? How?
25/30
How to Cope with NP-Completeness
I. HEURISTIC ALGORITHM
To find a solution within a reduced search-space.
II. APPROXIMATION ALGORITHM
To find approximately optimal solutions.
III. QUANTUM COMPUTING
To use the spins of quantum with the speed of
light. (bit 0, 1 spin-up (0), spin-down (1))
Why? What? How?
26/30
Heuristic Algorithm
• In NP-Complete Problems,
we have to check exponential possibilities.
• By Heuristic, reduce the search space.
• Example: Practical SAT problem Solvers
– zChaff, BerkMin, GRASP, SATO, etc.
Why? What? How?
27/30
Approximation
• Hard to find an exactly correct solution
in NP-complete problems
• By Approximation,
find a nearly optimal solution.
• Example: finding the smallest vertex covers
(we can find a vertex cover never more than
twice the size of the smallest one.)
Why? What? How?
28/30
Quantum Computation
• Bit 0 and 1 
Spin Up and Spin
Down
• Speed of electron
 Speed of light
Why? What? How?
Digital Comp.  Quantum Comp.
29/30
Conclusion
When a hard problem is given,
we can prove that a problem is NP-complete,
just by finding a polynomial time reduction.
After proving,
we can solve the problem in these ways:
Heuristic Algorithm, Approximation
Algorithm and Quantum computing.
30/30
Thank You for Listening.
Any Question?
Ad

More Related Content

What's hot (20)

NP completeness
NP completenessNP completeness
NP completeness
Amrinder Arora
 
Np completeness
Np completenessNp completeness
Np completeness
Rajendran
 
NP Complete Problems
NP Complete ProblemsNP Complete Problems
NP Complete Problems
Nikhil Joshi
 
np complete
np completenp complete
np complete
Gayathri Gaayu
 
9. chapter 8 np hard and np complete problems
9. chapter 8   np hard and np complete problems9. chapter 8   np hard and np complete problems
9. chapter 8 np hard and np complete problems
Jyotsna Suryadevara
 
Divide and conquer - Quick sort
Divide and conquer - Quick sortDivide and conquer - Quick sort
Divide and conquer - Quick sort
Madhu Bala
 
Np hard
Np hardNp hard
Np hard
jesal_joshi
 
Np completeness
Np completenessNp completeness
Np completeness
Muhammad Saim
 
Daa notes 1
Daa notes 1Daa notes 1
Daa notes 1
smruti sarangi
 
Data Structure and Algorithm - Divide and Conquer
Data Structure and Algorithm - Divide and ConquerData Structure and Algorithm - Divide and Conquer
Data Structure and Algorithm - Divide and Conquer
Laguna State Polytechnic University
 
Recursive algorithms
Recursive algorithmsRecursive algorithms
Recursive algorithms
subhashchandra197
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
Dr Shashikant Athawale
 
AI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction ProblemAI 7 | Constraint Satisfaction Problem
AI 7 | Constraint Satisfaction Problem
Mohammad Imam Hossain
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
Bulbul Agrawal
 
Analysis of algorithm
Analysis of algorithmAnalysis of algorithm
Analysis of algorithm
Rajendra Dangwal
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
Rajendran
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of Algorithms
Swapnil Agrawal
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
Dr Shashikant Athawale
 
Computational Complexity
Computational ComplexityComputational Complexity
Computational Complexity
Kasun Ranga Wijeweera
 
Undecidabality
UndecidabalityUndecidabality
Undecidabality
Anshuman Biswal
 

Similar to Introduction to NP Completeness (20)

DAA.pdf
DAA.pdfDAA.pdf
DAA.pdf
Arivukkarasu Dhanapal
 
DAA.pdf
DAA.pdfDAA.pdf
DAA.pdf
Arivukkarasu Dhanapal
 
P, NP, NP-Hard & NP-complete problems, Optimization
P, NP, NP-Hard & NP-complete problems, OptimizationP, NP, NP-Hard & NP-complete problems, Optimization
P, NP, NP-Hard & NP-complete problems, Optimization
DrSMeenakshiSundaram1
 
class23.ppt
class23.pptclass23.ppt
class23.ppt
AjayPratap828815
 
Teori pnp
Teori pnpTeori pnp
Teori pnp
Tenia Wahyuningrum
 
AA ppt9107
AA ppt9107AA ppt9107
AA ppt9107
Gitanjali Wakade
 
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
 
Lower bound theory Np hard & Np completeness
Lower bound theory Np hard & Np completenessLower bound theory Np hard & Np completeness
Lower bound theory Np hard & Np completeness
yvtinsane
 
lect5-1.ppt
lect5-1.pptlect5-1.ppt
lect5-1.ppt
VivekChaudhary865831
 
University timetable scheduling
University timetable schedulingUniversity timetable scheduling
University timetable scheduling
Ashish Mishra
 
UNIT -IV DAA.pdf
UNIT  -IV DAA.pdfUNIT  -IV DAA.pdf
UNIT -IV DAA.pdf
Arivukkarasu Dhanapal
 
NP Complete Problems in Graph Theory
NP Complete Problems in Graph TheoryNP Complete Problems in Graph Theory
NP Complete Problems in Graph Theory
Seshagiri Rao Kornepati
 
Internship
InternshipInternship
Internship
Seshagiri Rao Kornepati
 
Complexity theory
Complexity theory Complexity theory
Complexity theory
Dr Shashikant Athawale
 
teteuueieoeofhfhfjffkkkfkfflflflhshssnnvmvvmvv,v,v,nnxmxxm
teteuueieoeofhfhfjffkkkfkfflflflhshssnnvmvvmvv,v,v,nnxmxxmteteuueieoeofhfhfjffkkkfkfflflflhshssnnvmvvmvv,v,v,nnxmxxm
teteuueieoeofhfhfjffkkkfkfflflflhshssnnvmvvmvv,v,v,nnxmxxm
zoobiarana76
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
Amrinder Arora
 
2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練
Abner Huang
 
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
guest577718
 
Expert estimation from Multimodal Features
Expert estimation from Multimodal FeaturesExpert estimation from Multimodal Features
Expert estimation from Multimodal Features
Xavier Ochoa
 
Np completeness
Np completeness Np completeness
Np completeness
tusharKanwaria
 
Ad

More from Gene Moo Lee (14)

Developing A Big Data Analytics Framework for Industry Intelligence
Developing A Big Data Analytics Framework for Industry IntelligenceDeveloping A Big Data Analytics Framework for Industry Intelligence
Developing A Big Data Analytics Framework for Industry Intelligence
Gene Moo Lee
 
Big Data Analytics: Challenges and Opportunities
Big Data Analytics: Challenges and OpportunitiesBig Data Analytics: Challenges and Opportunities
Big Data Analytics: Challenges and Opportunities
Gene Moo Lee
 
Content Complexity, Similarity, and Consistency in Social Media: A Deep Learn...
Content Complexity, Similarity, and Consistency in Social Media: A Deep Learn...Content Complexity, Similarity, and Consistency in Social Media: A Deep Learn...
Content Complexity, Similarity, and Consistency in Social Media: A Deep Learn...
Gene Moo Lee
 
Analyzing the spillover roles of user-generated reviews on purchases: Evidenc...
Analyzing the spillover roles of user-generated reviews on purchases: Evidenc...Analyzing the spillover roles of user-generated reviews on purchases: Evidenc...
Analyzing the spillover roles of user-generated reviews on purchases: Evidenc...
Gene Moo Lee
 
Towards Advanced Business Analytics using Text Mining and Deep Learning
Towards Advanced Business Analytics using Text Mining and Deep LearningTowards Advanced Business Analytics using Text Mining and Deep Learning
Towards Advanced Business Analytics using Text Mining and Deep Learning
Gene Moo Lee
 
Towards a better measure of business proximity: Topic modeling for industry i...
Towards a better measure of business proximity: Topic modeling for industry i...Towards a better measure of business proximity: Topic modeling for industry i...
Towards a better measure of business proximity: Topic modeling for industry i...
Gene Moo Lee
 
Designing Cybersecurity Policies with Field Experiments
Designing Cybersecurity Policies with Field ExperimentsDesigning Cybersecurity Policies with Field Experiments
Designing Cybersecurity Policies with Field Experiments
Gene Moo Lee
 
Strategic Network Formation in a Location-Based Social Network
Strategic Network Formation in a Location-Based Social NetworkStrategic Network Formation in a Location-Based Social Network
Strategic Network Formation in a Location-Based Social Network
Gene Moo Lee
 
Matching Mobile Applications for Cross Promotion
Matching Mobile Applications for Cross PromotionMatching Mobile Applications for Cross Promotion
Matching Mobile Applications for Cross Promotion
Gene Moo Lee
 
Improving Sketch Reconstruction Accuracy
Improving Sketch Reconstruction AccuracyImproving Sketch Reconstruction Accuracy
Improving Sketch Reconstruction Accuracy
Gene Moo Lee
 
Improving the Interaction between Overlay Routing and Traffic Engineering
Improving the Interaction between Overlay Routing and Traffic EngineeringImproving the Interaction between Overlay Routing and Traffic Engineering
Improving the Interaction between Overlay Routing and Traffic Engineering
Gene Moo Lee
 
Modeling Human Mobility using Location Based Social Networks
Modeling Human Mobility using Location Based Social NetworksModeling Human Mobility using Location Based Social Networks
Modeling Human Mobility using Location Based Social Networks
Gene Moo Lee
 
Mobile Video Delivery via Human Movement
Mobile Video Delivery via Human MovementMobile Video Delivery via Human Movement
Mobile Video Delivery via Human Movement
Gene Moo Lee
 
Towards modeling M&A in high tech industries
Towards modeling M&A in high tech industriesTowards modeling M&A in high tech industries
Towards modeling M&A in high tech industries
Gene Moo Lee
 
Developing A Big Data Analytics Framework for Industry Intelligence
Developing A Big Data Analytics Framework for Industry IntelligenceDeveloping A Big Data Analytics Framework for Industry Intelligence
Developing A Big Data Analytics Framework for Industry Intelligence
Gene Moo Lee
 
Big Data Analytics: Challenges and Opportunities
Big Data Analytics: Challenges and OpportunitiesBig Data Analytics: Challenges and Opportunities
Big Data Analytics: Challenges and Opportunities
Gene Moo Lee
 
Content Complexity, Similarity, and Consistency in Social Media: A Deep Learn...
Content Complexity, Similarity, and Consistency in Social Media: A Deep Learn...Content Complexity, Similarity, and Consistency in Social Media: A Deep Learn...
Content Complexity, Similarity, and Consistency in Social Media: A Deep Learn...
Gene Moo Lee
 
Analyzing the spillover roles of user-generated reviews on purchases: Evidenc...
Analyzing the spillover roles of user-generated reviews on purchases: Evidenc...Analyzing the spillover roles of user-generated reviews on purchases: Evidenc...
Analyzing the spillover roles of user-generated reviews on purchases: Evidenc...
Gene Moo Lee
 
Towards Advanced Business Analytics using Text Mining and Deep Learning
Towards Advanced Business Analytics using Text Mining and Deep LearningTowards Advanced Business Analytics using Text Mining and Deep Learning
Towards Advanced Business Analytics using Text Mining and Deep Learning
Gene Moo Lee
 
Towards a better measure of business proximity: Topic modeling for industry i...
Towards a better measure of business proximity: Topic modeling for industry i...Towards a better measure of business proximity: Topic modeling for industry i...
Towards a better measure of business proximity: Topic modeling for industry i...
Gene Moo Lee
 
Designing Cybersecurity Policies with Field Experiments
Designing Cybersecurity Policies with Field ExperimentsDesigning Cybersecurity Policies with Field Experiments
Designing Cybersecurity Policies with Field Experiments
Gene Moo Lee
 
Strategic Network Formation in a Location-Based Social Network
Strategic Network Formation in a Location-Based Social NetworkStrategic Network Formation in a Location-Based Social Network
Strategic Network Formation in a Location-Based Social Network
Gene Moo Lee
 
Matching Mobile Applications for Cross Promotion
Matching Mobile Applications for Cross PromotionMatching Mobile Applications for Cross Promotion
Matching Mobile Applications for Cross Promotion
Gene Moo Lee
 
Improving Sketch Reconstruction Accuracy
Improving Sketch Reconstruction AccuracyImproving Sketch Reconstruction Accuracy
Improving Sketch Reconstruction Accuracy
Gene Moo Lee
 
Improving the Interaction between Overlay Routing and Traffic Engineering
Improving the Interaction between Overlay Routing and Traffic EngineeringImproving the Interaction between Overlay Routing and Traffic Engineering
Improving the Interaction between Overlay Routing and Traffic Engineering
Gene Moo Lee
 
Modeling Human Mobility using Location Based Social Networks
Modeling Human Mobility using Location Based Social NetworksModeling Human Mobility using Location Based Social Networks
Modeling Human Mobility using Location Based Social Networks
Gene Moo Lee
 
Mobile Video Delivery via Human Movement
Mobile Video Delivery via Human MovementMobile Video Delivery via Human Movement
Mobile Video Delivery via Human Movement
Gene Moo Lee
 
Towards modeling M&A in high tech industries
Towards modeling M&A in high tech industriesTowards modeling M&A in high tech industries
Towards modeling M&A in high tech industries
Gene Moo Lee
 
Ad

Recently uploaded (20)

Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,PhosphorosClass-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
govindapathak8
 
SuperconductingMagneticEnergyStorage.pptx
SuperconductingMagneticEnergyStorage.pptxSuperconductingMagneticEnergyStorage.pptx
SuperconductingMagneticEnergyStorage.pptx
BurkanAlpKale
 
Zoonosis, Types, Causes. A comprehensive pptx
Zoonosis, Types, Causes. A comprehensive pptxZoonosis, Types, Causes. A comprehensive pptx
Zoonosis, Types, Causes. A comprehensive pptx
Dr Showkat Ahmad Wani
 
Antonie van Leeuwenhoek- Father of Microbiology
Antonie van Leeuwenhoek- Father of MicrobiologyAntonie van Leeuwenhoek- Father of Microbiology
Antonie van Leeuwenhoek- Father of Microbiology
Anoja Kurian
 
Application of Microbiology- Industrial, agricultural, medical
Application of Microbiology- Industrial, agricultural, medicalApplication of Microbiology- Industrial, agricultural, medical
Application of Microbiology- Industrial, agricultural, medical
Anoja Kurian
 
On the Lunar Origin of Near-Earth Asteroid 2024 PT5
On the Lunar Origin of Near-Earth Asteroid 2024 PT5On the Lunar Origin of Near-Earth Asteroid 2024 PT5
On the Lunar Origin of Near-Earth Asteroid 2024 PT5
Sérgio Sacani
 
2025 Insilicogen Company Korean Brochure
2025 Insilicogen Company Korean Brochure2025 Insilicogen Company Korean Brochure
2025 Insilicogen Company Korean Brochure
Insilico Gen
 
amino compounds.pptx class 12_Govinda Pathak
amino compounds.pptx class 12_Govinda Pathakamino compounds.pptx class 12_Govinda Pathak
amino compounds.pptx class 12_Govinda Pathak
GovindaPathak6
 
Quiz 3 Basic Nutrition 1ST Yearcmcmc.pptx
Quiz 3 Basic Nutrition 1ST Yearcmcmc.pptxQuiz 3 Basic Nutrition 1ST Yearcmcmc.pptx
Quiz 3 Basic Nutrition 1ST Yearcmcmc.pptx
NutriGen
 
Skin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _ControlSkin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _Control
muralinath2
 
Preparation of Permanent mounts of Parasitic Protozoans.pptx
Preparation of Permanent mounts of Parasitic Protozoans.pptxPreparation of Permanent mounts of Parasitic Protozoans.pptx
Preparation of Permanent mounts of Parasitic Protozoans.pptx
Dr Showkat Ahmad Wani
 
DNA Profiling and STR Typing in Forensics: From Molecular Techniques to Real-...
DNA Profiling and STR Typing in Forensics: From Molecular Techniques to Real-...DNA Profiling and STR Typing in Forensics: From Molecular Techniques to Real-...
DNA Profiling and STR Typing in Forensics: From Molecular Techniques to Real-...
home
 
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
muralinath2
 
Botany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdf
Botany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdfBotany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdf
Botany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdf
JseleBurgos
 
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
ss0077014
 
Influenza-Understanding-the-Deadly-Virus.pptx
Influenza-Understanding-the-Deadly-Virus.pptxInfluenza-Understanding-the-Deadly-Virus.pptx
Influenza-Understanding-the-Deadly-Virus.pptx
diyapadhiyar
 
Introduction to Mobile Forensics Part 1.pptx
Introduction to Mobile Forensics Part 1.pptxIntroduction to Mobile Forensics Part 1.pptx
Introduction to Mobile Forensics Part 1.pptx
Nivya George
 
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Himarsha Jayanetti
 
Effect of nutrition in Entomophagous Insectson
Effect of nutrition in Entomophagous InsectsonEffect of nutrition in Entomophagous Insectson
Effect of nutrition in Entomophagous Insectson
JabaskumarKshetri
 
whole ANATOMY OF EYE with eye ball .pptx
whole ANATOMY OF EYE with eye ball .pptxwhole ANATOMY OF EYE with eye ball .pptx
whole ANATOMY OF EYE with eye ball .pptx
simranjangra13
 
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,PhosphorosClass-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
govindapathak8
 
SuperconductingMagneticEnergyStorage.pptx
SuperconductingMagneticEnergyStorage.pptxSuperconductingMagneticEnergyStorage.pptx
SuperconductingMagneticEnergyStorage.pptx
BurkanAlpKale
 
Zoonosis, Types, Causes. A comprehensive pptx
Zoonosis, Types, Causes. A comprehensive pptxZoonosis, Types, Causes. A comprehensive pptx
Zoonosis, Types, Causes. A comprehensive pptx
Dr Showkat Ahmad Wani
 
Antonie van Leeuwenhoek- Father of Microbiology
Antonie van Leeuwenhoek- Father of MicrobiologyAntonie van Leeuwenhoek- Father of Microbiology
Antonie van Leeuwenhoek- Father of Microbiology
Anoja Kurian
 
Application of Microbiology- Industrial, agricultural, medical
Application of Microbiology- Industrial, agricultural, medicalApplication of Microbiology- Industrial, agricultural, medical
Application of Microbiology- Industrial, agricultural, medical
Anoja Kurian
 
On the Lunar Origin of Near-Earth Asteroid 2024 PT5
On the Lunar Origin of Near-Earth Asteroid 2024 PT5On the Lunar Origin of Near-Earth Asteroid 2024 PT5
On the Lunar Origin of Near-Earth Asteroid 2024 PT5
Sérgio Sacani
 
2025 Insilicogen Company Korean Brochure
2025 Insilicogen Company Korean Brochure2025 Insilicogen Company Korean Brochure
2025 Insilicogen Company Korean Brochure
Insilico Gen
 
amino compounds.pptx class 12_Govinda Pathak
amino compounds.pptx class 12_Govinda Pathakamino compounds.pptx class 12_Govinda Pathak
amino compounds.pptx class 12_Govinda Pathak
GovindaPathak6
 
Quiz 3 Basic Nutrition 1ST Yearcmcmc.pptx
Quiz 3 Basic Nutrition 1ST Yearcmcmc.pptxQuiz 3 Basic Nutrition 1ST Yearcmcmc.pptx
Quiz 3 Basic Nutrition 1ST Yearcmcmc.pptx
NutriGen
 
Skin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _ControlSkin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _Control
muralinath2
 
Preparation of Permanent mounts of Parasitic Protozoans.pptx
Preparation of Permanent mounts of Parasitic Protozoans.pptxPreparation of Permanent mounts of Parasitic Protozoans.pptx
Preparation of Permanent mounts of Parasitic Protozoans.pptx
Dr Showkat Ahmad Wani
 
DNA Profiling and STR Typing in Forensics: From Molecular Techniques to Real-...
DNA Profiling and STR Typing in Forensics: From Molecular Techniques to Real-...DNA Profiling and STR Typing in Forensics: From Molecular Techniques to Real-...
DNA Profiling and STR Typing in Forensics: From Molecular Techniques to Real-...
home
 
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
muralinath2
 
Botany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdf
Botany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdfBotany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdf
Botany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdf
JseleBurgos
 
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
ss0077014
 
Influenza-Understanding-the-Deadly-Virus.pptx
Influenza-Understanding-the-Deadly-Virus.pptxInfluenza-Understanding-the-Deadly-Virus.pptx
Influenza-Understanding-the-Deadly-Virus.pptx
diyapadhiyar
 
Introduction to Mobile Forensics Part 1.pptx
Introduction to Mobile Forensics Part 1.pptxIntroduction to Mobile Forensics Part 1.pptx
Introduction to Mobile Forensics Part 1.pptx
Nivya George
 
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Himarsha Jayanetti
 
Effect of nutrition in Entomophagous Insectson
Effect of nutrition in Entomophagous InsectsonEffect of nutrition in Entomophagous Insectson
Effect of nutrition in Entomophagous Insectson
JabaskumarKshetri
 
whole ANATOMY OF EYE with eye ball .pptx
whole ANATOMY OF EYE with eye ball .pptxwhole ANATOMY OF EYE with eye ball .pptx
whole ANATOMY OF EYE with eye ball .pptx
simranjangra13
 

Introduction to NP Completeness

  • 1. 1 NP-Completeness November 28, 2003 Young Eun Kim and Gene Moo Lee Department of Computer Science & Engineering Korea University
  • 2. 2/30 Contents • Introduction and Motivation • Background Knowledge • Definition of NP-Completeness • Examples of NP-Complete Problems • Hierarchy of Problems • How to Prove NP-Completeness • How to Cope with NP-Complete Problems • Conclusion
  • 3. 3/30 Introduction (1/2) • Some Algorithms we’ve seen in this class – Sorting – O(N log N) – Searching – O(log N) – Shortest Path Finding – O(N2 ) • However, some problems only have – Exponential Time Algorithm O(2N ) – So What? Why? What? How?
  • 4. 4/30 Introduction (2/2) N 10 20 30 40 50 60 O(N) .00001 second .00002 second .00003 second .00004 second .00005 second .00006 second O(N2 ) .0001 second .0004 second .0009 second .0016 second .0025 second .0036 second O(N3 ) .001 second .008 second .027 second .064 second .125 second .216 second O(N5 ) 1 second 3.2 seconds 24.3 seconds 1.7 minutes 5.2 minutes 13.0 minutes O(2N ) .001 second 1.0 second 17.9 minutes 12.7 days 35.7 years 366 centuries O(3N ) .059 second 58 minutes 6.5 years 3855 centuries 2*108 centuries 1013 centuries Why? What? How?
  • 5. 5/30 Motivation • Traveling Salesman Problem (n = 1000) • Compute 1000! – Even Electron in the Universe is a Super Computer, – And they work for the Estimated Life of the Universe, – WE CANNOT SOLVE THIS PROBLEM!!! – This kind of problems are NP-Complete. Why? What? How?
  • 6. 6/30 Background Knowledge To understand NP-Completeness, need to know these concepts 1. Decision and Optimization Problems 2. Turing Machine and class P 3. Nondeterminism and class NP 4. Polynomial Time Reduction (Problem Transformation) Why? What? How?
  • 7. 7/30 Decision and Optimization Problems • What is the Shortest Path from A to B? – This is an Optimization Problem. • Is there a Path from A to B consisting of at most K edges? – This is the related Decision Problem. We consider only Decision Problems! Why? What? How?
  • 8. 8/30 Turing Machine and Class P (1/3) Church – Turing Thesis “Computer ≡ Turing Machine” Alan Turing(1912-1954) (www.time.com) Why? What? How?
  • 9. 9/30 Turing Machine and Class P (2/3) A Turing machine is a 7-tuple (Q, ∑, Γ, δ, q0, qaccept, qreject). Why? What? How?
  • 10. 10/30 Turing Machine and Class P (3/3) P : the class of problems that are decidable in polynomial time on a Turing machine Sorting, Shortest Path are in P! Why? What? How?
  • 11. 11/30 Nondeterminism and Class NP (1/2) • A Nondeterministic Turing machine is a Turing machine with the transition function has the form δ : Q * Γ  P(Q * Γ * {L, R}). • NTM guess to choose the answer nondeterministically Why? What? How?
  • 12. 12/30 Nondeterminism and Class NP (2/2) • NP : the class of problems that are decidable in polynomial time on a nondeterministic Turing machine • Solutions of problems in NP can be checked (verified) in polynomial time. • If a Hamiltonian path were discovered somehow, we could easily check if the path is Hamiltonian. – HAMPATH is in NP! Also Sorting is in NP! Why? What? How?
  • 13. 13/30 Class P and NP • P = the class of problems where membership can be decided quickly. • NP = the class of problems where membership can be verified quickly. Why? What? How?
  • 14. 14/30 Polynomial Time Reduction Traveling Salesman Problem5-CliqueMap Coloring Traveling Salesman Problem  5-Clique  Map Coloring Why? What? How?
  • 15. 15/30 Definition of NP-Completeness A problem B is NP-complete if it satisfies two conditions: 1. B is in NP, and 2. Every problem A in NP is polynomial time reducible to B. (NP-Hard) Why? What? How?
  • 16. 16/30 Meaning of NP-Completeness • NP: Nondeterministic Polynomial • Complete: – If one of the problems in NPC have an efficient algorithm, then all the problems in NP have efficient algorithms. Why? What? How?
  • 17. 17/30 Examples of NP-Completeness • Satisfiability (SAT) • Traveling Salesman Problem (TSP) • Longest Path (vs. Shortest Path is in P) • Real-Time Scheduling • Hamiltonian Path (vs. Euler Path is in P) Why? What? How?
  • 18. 18/30 Where are we? Background Knowledge Definition of NP-Completeness Examples of NP-Complete Problems • Hierarchy of Problems • How to Prove NP-Completeness • How to Cope with NP-Completeness
  • 19. 19/30 Hierarchy of Problems (1/2) P NP PSPACE = NPSPACE EXPTIME⊆ ⊆ ⊆ Conjectured Relationships EXPTIME NPSPACE NP P UNDECIDABLE Why? What? How?
  • 20. 20/30 Hierarchy of Problems (2/2) NP P Which one is correct? An efficient algorithm on a deterministic machine does not exist. An efficient algorithm on a deterministic machine is not found yet. P = NP Why? What? How?
  • 21. 21/30 How to prove NP-Completeness(1/3) • If B is NP-complete and B C for C in NP,∝ then C is NP-complete. B C NP-complete NP-complete Then, we need at least one NP-complete problem! Why? What? How?
  • 22. 22/30 How to prove NP-Completeness(2/3) Cook’s Theorem “Satisfiability Problem (SAT) is NP-complete.” - the first NP-complete problem! Stephen Cook (www.cs.toronto.edu) Why? What? How?
  • 23. 23/30 I’m also NP Complete! How to prove NP-Completeness(3/3) any NP problem can be reduced to... SAT new NP problem can be reduced to... Proved by Cook New Problem is “no easier” than SAT Why? What? How?
  • 24. 24/30 NP-Complete Problems Tree SAT 3-SAT Graph 3-Color 3-DM Exact Cover Planer 3-color Vertex Cover Subset-Sum HAMPATH Clique Partition Integer Programming IndependentTSP (Salesman) Why? What? How?
  • 25. 25/30 How to Cope with NP-Completeness I. HEURISTIC ALGORITHM To find a solution within a reduced search-space. II. APPROXIMATION ALGORITHM To find approximately optimal solutions. III. QUANTUM COMPUTING To use the spins of quantum with the speed of light. (bit 0, 1 spin-up (0), spin-down (1)) Why? What? How?
  • 26. 26/30 Heuristic Algorithm • In NP-Complete Problems, we have to check exponential possibilities. • By Heuristic, reduce the search space. • Example: Practical SAT problem Solvers – zChaff, BerkMin, GRASP, SATO, etc. Why? What? How?
  • 27. 27/30 Approximation • Hard to find an exactly correct solution in NP-complete problems • By Approximation, find a nearly optimal solution. • Example: finding the smallest vertex covers (we can find a vertex cover never more than twice the size of the smallest one.) Why? What? How?
  • 28. 28/30 Quantum Computation • Bit 0 and 1  Spin Up and Spin Down • Speed of electron  Speed of light Why? What? How? Digital Comp.  Quantum Comp.
  • 29. 29/30 Conclusion When a hard problem is given, we can prove that a problem is NP-complete, just by finding a polynomial time reduction. After proving, we can solve the problem in these ways: Heuristic Algorithm, Approximation Algorithm and Quantum computing.
  • 30. 30/30 Thank You for Listening. Any Question?

Editor's Notes

  • #2: Good Morning, everyone! My name is Gene Moo Lee. Let’s start our presentation. We are going to talk about NP-Completeness.
  • #3: This is the contents of our presentation. First, we will see why we have to study NPC. Then with background knowledge, we will formally define NPC. Then I will give you some examples of it. That is my part, and my partner Kim Young Eun will show you where NPC locates in the whole hierarchy of problems. And see how to prove a problem is NPC, and how to cope with that kind of problems.
  • #4: So far in our class, we’ve seen many algorithms to solve problems. Here are some of them. In these problems like sorting, searching, shortest path finding, we know algorithms with these time complexity. But unlike these problems, there are some problems that only have exponential time algorithm. So what? Let’s go to next page.
  • #5: Here is a table considering the time complexity. As you see here with polynomial time complexity, the time is very small. But if you see here with exponential time complexity with n is 50 or 60, the time is just too long!! 366 centuries!!
  • #6: Let’s take a look at a example of Traveling Salesman Problem with 1000 cities. In this problem, we want to know the shortest cycle with visiting all the 1000 cities one time. Then in the algorithm we know, we have to compute 1000 factorial cases! However, even if all the electron in the universe is super computes, and they work for the estimated life of the universe, We cannot compute 1000 factorial!. This kind of problems are called NP-Complete.
  • #7: To understand NPC, we have to know these concepts first. First, decision problems and optimization problems. Then Turing Machine and class P. Nondeterminism and class NP. Last, polynomial time reduction, also known as problem transformation.
  • #8: First, Decision problems and optimization problems. Let’s see this problem. What is the shortest path from A to B? This is an example of optimization problems. Next, is there a path from A to B consisting of at most k edges? This is the related decision problem of the problem above. But in the theory of NPC, we could only consider decision problems. So to think about optimization problems, we will think about the related decision problems.
  • #9: Next thing to know is Turing Machine, This handsome man is Alan Turing, who is one of the most famous computer scientist. By his theory, Computer and Turing machine have equal power to compute. So in the theory of NPC, we emulate the power of actual computers by Turing machines.
  • #10: This is the definition of Turing machine. And this is the conceptual picture of it. With its finite state control rule, a Turing machine reads input and write outputs to a tape and moves head to the right or left. After reading and writing, it can accept or reject in some situation just like finite automata.
  • #11: After we know what is a Turing machine, then we can define the class P. P is the class of problems that are decidable in polynomial time on a Turing machine. So Sorting and Shortest Path are in P. In the definition, “polynomial time” means that the problem can be easily solved in our real computers.
  • #12: Now, let’s look at a revised version of Turing machine. You know how a NFA is different from a DFA. In a given moment, NFA can change its state into many states. Same to the Turing machine. A NTM can compute many things simultaneously. As you see in this picture, NTM has a guessing module to guess the answer.
  • #13: Then we can define the class NP. NP is the class of problems that are decidable in polynomial time on a NTM. The meaning is this. If we have a solution of the problem, then the NTM can determine whether the solution is right or wrong. For example, in the case of Hamiltonian Path problem, say we discover a HAMPATH somehow. Then we can easily see if the answer is right. So HAMPATH is in NP. Also a DTM is also a NTM, so all the problems in P is also in NP. P is a subset of NP!
  • #14: Here we briefly explain P and NP again. In the problems in P, we can solve the problems with efficient algorithm in polynomial time. In the problems of NP, if the solution is given, then we can check if the solution is right in polynomial time.
  • #15: The last thing to know NPC is polynomial time reduction. This concept indicates that some problems are connected each other. Let’s look at this example. First, Traveling Salesman Problem can be described like this. Next, 5-Clique can be shown like this. We can see that those two problems are pretty similar to each other. Also, Map Coloring problem is also similar to those. Then we say that TSP can be reduced to 5-Clique. And 5-Clique can be reduced to Map Coloring.
  • #16: Now we can define NPC. A problem B is NPC if B is in NP and all problems can be reduced to the problem B. All problem satisfying the second condition are called NP-Hard. So all NPC problems are NP-Hard. But not all NP-hard problems are NPC.
  • #17: This is the underlying meaning of NPC. NP indicates Nondeterministic Polynomial. Complete means that if one of the problems in NPC have an efficient algorithm, then all problems in NP have efficient algorithms. So theoretically the problems in NPC are really concentrated by scholars.
  • #18: Here are some examples of NPC. SAT problem is this. “Given a formula, is there a truth assignment that makes the formula true?” And TSP, we’ve seen it. Longest Path is to find the longest path from A to B. Also real-time scheduling in Operating System is NPC. HAMPATH, too. This is all for me. And my partner will cover the rest of our presentation.
  • #19: My partner explained you the definition of NPC, and gave some examples of those. Now I will show you where NPC are located in the hierarchy of problems. And I will explain how to prove a problem is NPC, and how to cope with NPC problems. Then make a conclusion.
  • #20: All the problems in this world can be sorted by two catagories. That is, undecidable problem, decidable problems. And undecidable problems have hierarchy. It is described here. Exponential-time space contains NPSPACE, and NPSPACE have NP problems. And the set of P problems is contained in the set of NP problems.
  • #21: Let’s see the relationship of NP and P problems. There can two relationships like here. The first one means that an efficient algorithm on a deterministic machine does not exist. On the contrary, the second one means that an efficient algorithm on a deterministic machine is not found yet. But no one know which one is correct yet.
  • #22: Now, we’re going to see how to prove NP-completeness. If B is NP-complete and B is reducible to C in NP, then C is NP-complete. But before using this method, the NP-complete problem is necessary.
  • #23: We can get the first NP-complete problem by Cook’s theorem. Stephen Cook proved that SAT is NP-complete. So he enables us to find another NP-complete problems. The detailed proving process is abbreviated.
  • #24: Now we will trace how to prove NP-completeness using Cook’s theorem. First, any NP problems can be reduced to SAT. This is proved by Cook. And SAT can be reduced to a new NP problems. Then, the found NP problem becomes NP-complete.
  • #25: Using the way of proving NP-completeness in the previous page, we can find many NP-complete problems. It is illustrated here. SAT is NP-complete problem, and SAT is reduced to these two NP problems, then those are NP-complete problems. We use this process repeatedly, then many NP-complete problems are found like here.
  • #26: Even though we proved that a problem is NP-complete, the problem will not disappear. So we have to find alternatives to resolve the problem. Here we propose three ways to cope with NP-complete problems.
  • #27: The first one is Heuristic Algorithm. NP-complete problems require to check exponential possibilities. But this algorithm reduces the search space. So, the number of checking is lowered. As a result, the possibility to find an answer is increased.
  • #28: The second way of solving the NP-complete problems is using approximation algorithm. This algorithm is designed to find nearly optimal solution, not to find the best answer. If you try to find the exactly right answer, it will be difficult. So, this algorithm let us to solve a NP-complete problem a little bit easily. As an example, finding a vertex cover which has less than twice the size of the smallest one can be selected.
  • #29: The another one of coping with NP-complete problems is using a quantum computer. A quantum computer uses quantum’s spins. That is, spin up as bit 0 and spin down as bit 1. Moreover, quantum moves with the speed of light. So processing power, amount of work done in a specific time is increased compared to that of a digital computer. As a result, NP-complete problem requiring hundreds of years can be solved in a few seconds.
  • #30: Now we are in the conclusion. We learned that when a hard problem is given, we can prove that a problem is NP-complete by a polynomial time reduction. And after being proved, the problem is solved by some ways, Heuristic Algorithm, Approximation algorithm, and quantum computing.
  • #31: Here is the end of our presentation. Do you have any question?