This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 1 Intractable Problems TimeBounded Turing Machines Classes P and NP PolynomialTime Reductions 2 TimeBounded 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)) runningtime algorithm.” 3 The class P ◆ If a DTM M is T(n)time bounded for some polynomial T(n), then we say M is polynomialtime (“ 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
 Spring '08
 Motwani,R
 knapsack, polytime

Click to edit the document details