lect19-npCompleteness

lect19-npCompleteness - 1 Intractable Problems Time-Bounded...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 Intractable Problems Time-Bounded Turing Machines Classes P and NP Polynomial-Time Reductions 2 Time-Bounded TM’s ◆ A Turing machine that, given an input of length n, always halts within T(n) moves is said to be T(n)-time bounded . ◗ The TM can be multitape. ◗ Sometimes, it can be nondeterministic. ◆ The deterministic, multitape case corresponds roughly to “an O(T(n)) running-time algorithm.” 3 The class P ◆ If a DTM M is T(n)-time bounded for some polynomial T(n), then we say M is polynomial-time (“ polytime ”) bounded. ◆ And L(M) is said to be in the class P . ◆ Important point : when we talk of P , it doesn’t matter whether we mean “by a computer” or “by a TM” (next slide). 4 Polynomial Equivalence of Computers and TM’s ◆ A multitape TM can simulate a computer that runs for time O(T(n)) in at most O(T 2 (n)) of its own steps. ◆ If T(n) is a polynomial, so is T 2 (n). 5 Examples of Problems in P ◆ Is w in L(G), for a given CFG G? ◗ Input = w. ◗ Use CYK algorithm, which is O(n 3 ). ◆ Is there a path from node x to node y in graph G? ◗ Input = x, y, and G. ◗ Use Dijkstra’s algorithm, which is O(n log n) on a graph of n nodes and arcs. 6 Running Times Between Polynomials ◆ You might worry that something like O(n log n) is not a polynomial. ◆ However, to be in P , a problem only needs an algorithm that runs in time less than some polynomial. ◆ Surely O(n log n) is less than the polynomial O(n 2 ). 7 A Tricky Case : Knapsack ◆ The Knapsack Problem is: given positive integers i 1 , i 2 ,…, i n , can we divide them into two sets with equal sums?...
View Full Document

Page1 / 28

lect19-npCompleteness - 1 Intractable Problems Time-Bounded...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online