{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lec27_28_NP

# Lec27_28_NP - The Theory of NPCompleteness Tractable and...

This preview shows pages 1–10. Sign up to view the full content.

The Theory of NP- Completeness Tractable and intractable problems NP-complete problems

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Classifying problems Classify problems as tractable or intractable. Problem is tractable if there exists at least one polynomial bound algorithm that solves it. An algorithm is polynomial bound if its worst case growth rate can be bound by a polynomial p ( n ) in the size n of the problem constant a is where ... ) ( 0 1 k a n a n a n p k n + + + =
Intractable problems Problem is intractable: All algorithms that solve the problem are not polynomial bound. E.g., undecidable problem (halting problem) It has a worst case growth rate f ( n ) which cannot be bound by a polynomial p(n) in the size n of the problem. For intractable problems the bounds are: f n c n n n ( ) , , log = or etc.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Halting Problem Halting problem: given a computer program and an input to it, determine whether the program will halt on that input or continue working indefinitely on it. Trial solution : Just run the program with the given input. If the program stops, we know the program stops. But if the program doesn't stop in a reasonable amount of time, we cannot conclude that it won't stop. Maybe we didn't wait long enough.
Halting Problem Halting Problem is unsolvable The proof was devised by Alan Turing, 1936 Suppose you have a solution to the halting problem, called H. H takes two inputs: A program P and an input I for the program P . H generates an output " halt " if H determines that P stops on input I; Or it outputs " loop " otherwise. Prog P Input I Halt or loop

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
We can take P as both input and the Program. Then we devise another program K. If H outputs Loop, then K outputs Halt. If H outputs Halt, then K outputs Loop forever; K will do the opposite of H's output. function K() { if (H()=="loop"){ return; } else { while(true); //loop forever } } H Prog P Loop? Halt F loop T Halting Problem
Halting Problem Since K is a program, let us use K as the input to K. If H says that K halts then K itself would loop (that's how we constructed it). If H says that K loops then K will halt. In either case H gives the wrong answer for K. Thus H cannot work in all cases. We've shown that it is possible to construct an input that causes any solution H to fail. H Prog K Loop? Halt F loop T

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Why is this classification useful? If problem is intractable, no point in trying to find an efficient algorithm All algorithms will be too slow for large inputs .
Turing showed some problems are so hard that no algorithm can solve them (undecidable) (e.g., Halting problem) Other researchers showed some decidable problems from automata, mathematical logic, etc. are intractable: Presburger Arithmetic. P

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 47

Lec27_28_NP - The Theory of NPCompleteness Tractable and...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online