Mohamed M. El Wakil Mohamed M. El Wakil mohamed@elwakil.net
1
Agenda
1. 2. 3. 4. 5. 5 What is a problem? Decidable or not? Decidable or not? The P class The NP Class The NP Complete class The NP‐Complete class
2
What is a problem? What is a problem?
• A problem is a question to be answered.
– What is the value of X/Y?
• A problem usually has parameters. p y p
– X, and Y
• A decision problem is a version of the A decision problem, is a version of the problem with only two possible answers: Yes or No! or No!
– Given two numbers X, and Y, does Y evenly divide X?
• An instance: a specific problem instance
– Does 3 evenly divide 6?
3
Decidable or not? Decidable or not?
• A decidable problem, is a problem that could be solved using a computer. • A An undecidable problem, is a problem that d id bl bl i bl th t can never be solved using a computer, neither now or in the future. • Only decidable problems!
4
Classification
• We need to classify problems in terms of their p y computability. • Th Three classes: l
– P class – NP Class – NP‐Complete class NP‐Complete class
5
P class, wrt P class wrt Computers
• Problems with at least one algorithm that solves the problem in polynomial time wrt to l h bl i l i l i the input size. • Polynomial time Polynomial time
– The number of steps needed relates polynomially to the size of the input. to the size of the input – O(n2), O(n9), O(nc), where c is a constant. – but NOT O(n!) O(2n) when n is the size of the but NOT O(n!), O(2 ), when n is the size of the input.
6
P class, wrt Turing Machines P class wrt Turing Machines
• Problems solvable in polynomial time using a Deterministic Turing Machine (DTM) belong to D t i i ti T i M hi (DTM) b l t the class P. • Polynomial time
– The number of moves needed relates polynomially to the size of the input.
• n2, 17n3, 9n4, but NOT 2n
• DTM
– A