Complexity (Pre Lecture)

Size: px
Start display at page:

Download "Complexity (Pre Lecture)"

Transcription

1 Complexity (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2018 Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

2 Why? What can we always compute efficiently? What can we not always compute efficiently? How can we sometimes solve hard problems efficiently? Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

3 Outline Time Complexity Complexity Relationships Multi-Tape Turing Machines Nondeterministic Turing Machines P vs. NP NP-Completeness Other NP-Complete Problems Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

4 Time Complexity Outline Time Complexity Complexity Relationships Multi-Tape Turing Machines Nondeterministic Turing Machines P vs. NP NP-Completeness Other NP-Complete Problems Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

5 Time Complexity Measuring Time I Computation takes time I Physical TM: read-transition-write Two different questions: I 1. How fast is a computer? 2. How fast is an algorithm? Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

6 Time Complexity Asymptotic (big-o) notation Definition: Asymptotic Upper Bound f (n) = O(g(n) represents the asymptotic upper bound of f (n) without regard for constant factors. Specifically: Given functions f and g: f, g : N R + If there exists natural numbers c and n 0 where: (n > n 0 ), (f (n) cg(n)), We indicate the asymptotic upper bound of f (n) as O(g(n)) Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

7 Time Complexity Exercise: Big-O (1/2) 2n O(n) 3n + 2n 2 4 ln n 5 log 10 n = 5 ln n ln 10 Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

8 Time Complexity Exercise: Big-O (2/2) Given: Input size n Function f (n) Positive, non-zero constants a, b, k Then: O(a) = O(a + f (n)) = O(a f (n)) = O(an k + bn k+1 ) = O(log k f (n)) = Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

9 Time Complexity Asymptotic Time Complexity Definition: Asymptotic Time Complexity The asymptotic time complexity of a Turing machine (algorithm) T that halts on all inputs is the asymptotic upper bound on the number of steps T takes for a given input size n. That is, given input of size n, Turing machine T will take some f (n) steps to compute its result. The asymptotic time complexity of T is O(f (n)) Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

10 Time Complexity Time Complexity Terms Constant: O(1) Logarithmic: O(ln n) Linear: O(n) Quadratic: O(n 2 ) Cubic: O(n 3 ) Polynomial: O(n k ) Exponential: O(2 nα ), where α > 0 Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

11 Time Complexity Example: Turing-Machine Time Complexity (0) Formal Description start q 0 1 x, R {0, 1} R # R x R q 2 # R q 4 x R 1 x, L L = {ω#ω ω {0, 1} } {0, 1, x} L {0, 1} L q R # L 7 q acc q 5 q 6 0 x, R # R q 1 q 3 0 x, L {0, 1} R x R x R Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

12 Time Complexity Example: Turing-Machine Time Complexity (1) High-Level Description 1. For each string in the first half of the input, replace with x and sweep to the corresponding position in the second half 2. If the item in the second half does not match, reject 3. Otherwise, the item matches, replace with x and sweep back to the next element in the first half 4. When all items have been matched and replaced with x, accept. ( n ( n 2 2 {}}{{}}{ for each item in the first half, sweep forward, + n 2 ) {}}{ then sweep back ) ( n ( n O n )) = O ( n 2) 2 Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

13 Time Complexity Time Complexity Class Definition: Time Complexity Time For function t : N R +, the time complexity class time(t(n)) is the set of languages (problems) decidable by a Turing machine (algorithm) in time O(t(n)). Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

14 Time Complexity Example: Sorting Time Complexity Class Given: Sequence (x 0,..., x n ) X Order relation : X X B Find: Re-ordering of x, (y 0,..., y n ) where every y i y i+1 Assumptions: is O(1) Algorithms: Bubble Sort: O(n 2 ) Insertion Sort: O(n 2 ) Selection Sort: O(n 2 ) Heap Sort: O(n ln n) Merge Sort: O(n ln n) Time Complexity Class: O(n ln n) Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

15 Time Complexity Example: Bit-sequence Sorting Given: Sequence (x 0,..., x n ) (B k ) Order relation : B k B k B Find: Re-ordering of x, (y 0,..., y n ) where every y i y i+1 Assumptions: is O(1) Algorithms: Bubble Sort: O(n 2 ) Insertion Sort: O(n 2 ) Selection Sort: O(n 2 ) Heap Sort: O(n ln n) Merge Sort: O(n ln n) Radix Sort: O(n) Time Complexity Class: O(n) Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

16 Complexity Relationships Outline Time Complexity Complexity Relationships Multi-Tape Turing Machines Nondeterministic Turing Machines P vs. NP NP-Completeness Other NP-Complete Problems Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

17 Complexity Relationships Multi-Tape Turing Machines Multi-Tape Turing Machines Finite Control Q δ : Q {accept, reject} read k tapes {}}{ write k tapes {}}{ Γ k Q Γ k k moves: left, right, stay {}}{ {L, R, S} k a 0 a 1 b 0 b 1 b 2 b 3 c 0 c 1 c 2 Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

18 Complexity Relationships Multi-Tape Turing Machines Simulate Multi-Tape on Single Tape Finite Control Q {accept, reject} virtual heads # a 0 a1 # b 0 b 1 b2 b 3 # c 0 c 1 c 2 # not head Γ {}}{ = Γ, tape head {}}{ tape separator {}}{ # Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

19 Complexity Relationships Multi-Tape Turing Machines Multi-Tape Simulation Complexity Theorem: Multi-Tape Simulation Complexity Let M be a multi-tape Turing machine with time complexity of O(f (n)). Then, we can simulate M with a single-tape Turing machine S with time complexity O(f 2 (n)). Proof Outline M takes O(f (n)) steps. Each step of the simulation M on S takes at most O(f (n)) steps. Thus, S is O(f 2 (n)). Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

20 Complexity Relationships Multi-Tape Turing Machines Multi-Tape Simulation Steps virtual heads # a 0 a1 # b 0 b 1 b2 b 3 # c 0 c 1 c 2 # To simulate a multi-tape move of M: 1. Scan single-tape of S to determine symbols under each virtual head (finite combinations) 2. Re-scan single-tape to update symbols and virtual head positions If a virtual head moves onto tape separator (#) 1. Write a blank symbol ( ) over the #. 2. Shift tape contents right by one space. 3. Resume simulation. Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

21 Complexity Relationships Multi-Tape Turing Machines Multi-Tape Simulation Complexity Proof Details Writing the initial tape configuration of S takes O(n) to copy the length n input For each step of M, S makes two passes over the active (written/non-blank) portion of its tape: 1. Read the contents of the tape under each virtual head 2. Write the updated symbol under each virtual head The active portion of the tape has at most O(f (n)) entries, because we can write at most one new entry per step when moving right. (left moves do not grow the active portion) Thus, S takes O(n) + O(f 2 (n)) steps Assuming O(f 2 (n)) O(n), then S is O(f 2 (n)) Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

22 Complexity Relationships Nondeterministic Turing Machines Nondeterministic Turing Machines Finite Control Q {accept, reject} read-write head γ 0... γ i... γ n... δ : Q Γ P (Q Σ {L, R}) }{{} set of successor configurations Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

23 Complexity Relationships Nondeterministic Turing Machines Nondeterministic TM Runtime Definition Definition: Nondeterministic Runtime For nondeterministic TM N that always accepts or rejects, the running time of N is function f : N N, where f (n) is the maximum number of steps used by N on any branch of the computation. Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

24 Complexity Relationships Nondeterministic Turing Machines Nondeterministic TM Runtime Illustration Deterministic Start Nondeterministic Start... f (n) f (n) Accept/Reject Accept Reject Reject Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

25 Complexity Relationships Nondeterministic Turing Machines Nondeterministic Simulation Complexity Theorem: Nondeterministic Simulation Complexity Given nondeterministic TM N that always accepts or rejects and has runtime complexity f (n), there is an equivalent deterministic TM T with runtime complexity 2 O(f (n)). Proof Outline We simulate nondeterministic TM N with deterministic TM T. T searches the branches of N s nondeterministic computation. T s search requires 2 O(f (n)) steps. Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

26 Complexity Relationships Nondeterministic Turing Machines Nondeterminism Branch Addressing C [0] = q 0 σ 0... σ n ( C [1] ) 0 ( C [1] ) 1... ( C [1] ) b ( C [1] ) 0,0... ( C [1] ) 0,b ( C [1] ) b,0... ( C [1] ) b,b ( C [1] ) b,... C acc Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

27 Complexity Relationships Nondeterministic Turing Machines Deterministic Simulation: Iterative Deepening Search Diagram Finite Control Q {accept, reject} σ 0 σ 1... σ n 1 σ n Input Tape γ 0 γ 1 γ 2 γ 3 Simulation Tape Address Tape Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

28 Complexity Relationships Nondeterministic Turing Machines Nondeterministic Simulation Complexity Details Iterative deepening search: visit all nodes at depth d before visiting any nodes at d + 1 Node count given b branches at each level: O(b f (n) ) Time to visit (deepen from the root) a node: O(f (n)) Runtime: O(f (n)b f (n) ) = 2O(f (n)) Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

29 P vs. NP Outline Time Complexity Complexity Relationships Multi-Tape Turing Machines Nondeterministic Turing Machines P vs. NP NP-Completeness Other NP-Complete Problems Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

30 P vs. NP The Class P Definition: The Class P P is the class of languages decidable in polynomial time by a deterministic, single-tape Turing machine: P = k N time(n k ) Deterministic computation models are polynomially-equivalent. Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

31 P vs. NP Every Regular Language is in P Theorem Every Regular Language is in P. Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

32 P vs. NP Every Context-Free Language is in P Theorem Every Context-Free Language is in P. Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

33 P vs. NP DPLL Time Complexity Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

34 P vs. NP SAT Verification Time Complexity Given: φ: Boolean formula m: Bindings for predicates in φ (called model of φ) Algorithm: Find: Does m make φ true? m = φ Runtime: O( m + φ ) 1. Substitute m into φ 2. Evaluate resulting expression If is often faster to verify than to solve Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

35 P vs. NP Verifiers Definition: Verifier A verifier for language L is an algorithm V, where: L = {ω (ω, m) L (V ) for some string m} That is: ( m, ((ω, m) L (V ))) (ω L) m is a proof that ω L Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

36 P vs. NP Verify to Solve (nondeterministically) Given: Deterministic verifier V for language L Find: Nondeterministic TM N where: L (N) = L Algorithm: N = 1. Nondeterministically select (every) m. 2. Simulate V on each m 3. If any simulation of V accepts, N accepts Runtime: If V is O(f (n), then N is also O(f (n)) (but nondeterministic) Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

37 P vs. NP Nondeterministic Time Complexity Class Definition: Nondeterministic Time Complexity Time For function t : N R +, the nondeterministic time complexity class ntime(t(n)) is the set of languages (problems) decidable by a Nondeterministic Turing machine in time O(t(n)). Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

38 P vs. NP The Class NP Definition: The Class NP NP is the class of languages with polynomial-time verifiers. Equivalently, NP is the class of languages decidable in polynomial time by a nondeterministic Turing machine: NP = k N ntime(n k ) Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

39 P vs. NP P vs. NP P Decide in O(n k ) on DTM NP Verify in O(n k ) on DTM Decide in O(n k ) on NTM P NP NP P? = NP P P = NP Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

40 NP-Completeness Outline Time Complexity Complexity Relationships Multi-Tape Turing Machines Nondeterministic Turing Machines P vs. NP NP-Completeness Other NP-Complete Problems Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

41 NP-Completeness Cook-Levin Theorem Theorem: Cook-Levin Theorem (SAT P) (P = NP) Proof Outline 1. (P = NP) = (SAT P) We have a polynomial time, nondeterministic TM/algorithm to solve SAT, i.e., guess and verify 2. (SAT P) = (P = NP) We can reduce (convert) any nondeterministic TM to SAT. That is, solving SAT in polynomial time will solve any nondeterministic TM in polynomial time. Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

42 NP-Completeness Reduction of A to B Given: Algorithm for language B Function g : Σ Σ, where: ω A g(ω) B Find: Algorithm for A Solution: A = {ω g(ω) B} 1. Apply g to ω 2. Apply B to resulting g(ω) Procedure A(ω) 1 return B(g(ω)); Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

43 NP-Completeness Reducing Nondeterministic TM to SAT Overview 1. Unroll: Represent one branch of NTM computation as a tableau. Each row is the NTM configuration at one step 2. Variables: Boolean variables represent entries in each cell of the tableau. 3. Formula: Boolean formula encodes the start, accept, and moves of the NTM. Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

44 NP-Completeness Illustration: NTM Tableau # q 0 ω 0 ω 1... ω n... # start configuration # # second configuration n k... # # n k th configuration n k Represents configuration history for one branch Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

45 NP-Completeness SAT Variables τ [i,j] : Tableau contents at row i, column j Tableau values: S = Q Γ {#} Variables: S (nk ) 2 Boolean var {}}{ ( S l [i,j] ) tableau contents {}}{ (τ [i,j] = S l ) ( S l [i,j] ) is true when τ [i,j] contains S l Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

46 NP-Completeness Example: SAT Variables Tableau Q = {q 0, q 1 } Γ = {a, b} q 0 a b b q 1 b b a q 0 Cell 0,0 τ [0,0] = q 0 q [0,0] 0 = 1 q [0,0] 1 = 0 a [0,0] = 0 b [0,0] = 0 Boolean variable assignment encodes a TM branch Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

47 NP-Completeness Exercise: SAT Variables Tableau Cell 0,0 Cell 0,1 Cell 1,0 Q = {q 0, q 1 } τ [0,0] = q 0 τ [0,1] = a τ [1,0] = b Γ = {a, b} q 0 a b b q 1 b b a q 0 q [0,0] 0 = 1 q [0,0] 1 = 0 a [0,0] = 0 b [0,0] = 0 Boolean variable assignment encodes a TM branch Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

48 NP-Completeness SAT Formula Outline 1. Start configuration: φ start 2. Accept configuration: φ acc 3. Cell contents: φ cell 4. TM Move: φ move φ = φ start φ acc φ cell φ move Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

49 NP-Completeness SAT Formula Start and Accept Configurations Start: Start configuration holds at step 0, head pos. input string blank symbols {}}{{}}{{}}{ [0,0] φ start = q 0 σ [0,1] 0 σ [0,2] 1... σ [0,n+1] n [0,n+2]... [0,nk ] Accept: Some step visits the accept state, accept at step 0 accept at step 1 accept at step n {}}{{}}{{}} k { φ acc = q [0,0] [0,n a... q k] a q [1,0] [1,n a... q k] [n a... q k,0] [n a... q k,n k ] a Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

50 NP-Completeness SAT Formula Cell Contents and Exclusion φ cell = 0 i n k }{{} rows 0 i n k }{{} rows 0 j n k }{{} cols 0 j n k }{{} cols 0 l m }{{} symbols Cell i,j has some symbol { }} { cell contents {}}{ [i,j] s l 0 l m }{{} symbols cell contents {}}{ s l [i,j] = all others false {}}{ ( s ) [i,j] 0... s [i,j] l 1 s [i,j] [i,j] l+1... s m } {{ } cell i,j has only one symbol Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

51 NP-Completeness SAT Formula Window preservation TM Tape Configurations Tableau γ x γ y γ z... γ x γ y γ z... j 1 j j + 1 i... γ x γ y γ z... i γ x γ y γ z... γ x γ y γ z... γ x γ y γ z... no head near j { }}{ φ win = ( q [i,j 1] q [i,j] q [i,j+1]) q Q = s l S ( s l [i,j] s l [i+1,j] ) } {{ } preserve γ y Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

52 NP-Completeness SAT Formula Move Right q p γ y γ y, R q s TM Tape Configurations Tableau q p γ x γ y γ z q s γ x γ y γ z... γ x q p γ y γ z γ x γ y q s γ z... j 1 j j + 1 i... γ x q p γ y γ z... i γ x γ y q s γ z... φ δ = set state {}}{ q s [i+1,j+1] s l S ( [i,j 1] s l write tape {}}{ γ y [i+1,j+1] ) [i+1,j 1] s l } {{ } preserve γ x Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

53 NP-Completeness SAT Formula Move Left q p γ y γ y, L q s q p γ x γ y γ z q s TM Tape Configurations Tableau γ x γ y γ z... γ x q p γ y γ z q s γ x γ y γ z... j 1 j j + 1 i... γ x q p γ y γ z... i q s γ x γ y γ z... φ δ = set state {}}{ q s [i+1,j 1] s l S ( [i,j 1] s l write tape {}}{ γ y [i+1,j+1] ) [i+1,j] s l }{{} preserve γ x Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

54 NP-Completeness SAT Formula Move φ move = 0 i n k 0 j n k {}}{ [i,j] (φ ) win preserve window q Q tape head/state {}}{ q [i,j] = take one and only one transition {}}{ (φ ) [i,j] [i,j] (δ,q,0)... φ (δ,q,0,e) Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

55 NP-Completeness SAT Formula Summary φ = φ start φ acc φ cell φ move Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

56 NP-Completeness SAT is NP Complete f : Φ Σ SAT : Φ B NTM : Σ B g : Σ Φ SAT Reduces to NTM Procedure SAT(φ) 1 return NTM(f (φ)); NTM Reduces to SAT Procedure NTM(σ) 1 return SAT(g(σ)); Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

57 NP-Completeness X is NP Complete f : Θ Σ X : Θ B NTM : Σ B g : Σ Θ f : Φ Σ f : Φ Σ X : Θ B SAT : Φ B NTM : Σ B g : Σ Φ g : Σ Φ Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

58 NP-Completeness All NP Complete Problems are Equivalent Every f, g P f : Ω 0 Ω 1 f : Ω 1 Ω 2 f : Ω n 1 Ω n f : Ωn Σ X 0 : Ω 0 B X 1 : Ω 1 B X n : Ω n B NTM : Σ B g : Ω 1 Ω 0 g : Ω 2 Ω 1 g : Ω n Ω n 1 g : Σ Ω n Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

59 NP-Completeness P vs. NP Summary X in NP: X has a deterministic, polynomial time verifier X is NP-hard: Polynomial time reduction from NTM (or any other NP-hard problem) to X X is NP-complete: In NP and NP-hard NP-hard NP-hard P NP NP-complete P = NP NP-complete NP P = NP P Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

60 NP-Completeness Cook and Levin Stephen Cook. The complexity of theorem proving procedures Dantam (Mines CSCI-561) Leonid Levin. Universal search problems (Russian) Complexity (Pre Lecture) Fall / 70

61 Other NP-Complete Problems Outline Time Complexity Complexity Relationships Multi-Tape Turing Machines Nondeterministic Turing Machines P vs. NP NP-Completeness Other NP-Complete Problems Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

62 Other NP-Complete Problems 3SAT Given: Boolean formula φ in CNF with exactly three literals per clause: φ = (a 0 b 0 c 0 ) (a 1 b 1 c 1 )... (a n b n c n ) Find: Is φ satisfiabile? m, m = φ Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

63 Other NP-Complete Problems 3SAT is NP-Complete Reduce 3SAT to SAT: Trivially Reduce SAT to 3SAT: Rewrite nonconformant clauses as follows: (a) (a duplicate {}}{ a a ) duplicate {}}{ (a b) (a b a ) new variable new variable {}}{{}}{ (a b c d) (a b x ) ( x c d) recurse {}}{ (a b c d 0... d n ) (a b x) ( x c d 0... d n ) Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

64 Other NP-Complete Problems Hamiltonian Path Given: Directed graph G Nodes s and t in G Find: A path from s to t that visits all nodes in G exactly one time 3 5 s 1 2 t 4 6 Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

65 Other NP-Complete Problems Hamiltonian Path is in NP Polynomial Time Verifier: 1. Check that path starts at s and ends at t 2. Check that path contains each node only once 3. Check that sequential nodes in path are adjacent in graph Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

66 Other NP-Complete Problems Hamiltonian Path is NP-Complete 3SAT reduces to HAMPATH φ = (x 0 x 1 x 2 ) ( x 0 x 1 x 2 ) ( x 0 x 1 x 2 ) s x 0 x 0 x 0 x 1 x 2 e 0 x 0 x 1 x 2 x 1 x 1 x 0 x 1 x 2 e 1 x 2 x 2 t Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

67 Other NP-Complete Problems Hamiltonian Path is NP-Complete 3SAT reduces to HAMPATH Solution m : x 0 x 1 x 2 s x 0 x 0 x 0 x 1 x 2 e 0 x 0 x 1 x 2 x 1 x 1 x 0 x 1 x 2 e 1 x 2 x 2 t Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

68 Other NP-Complete Problems CLIQUE Given: Undirected Graph G, number k Find: A set of k vertices that form a clique, i.e., every vertex in the set has an edge to every other vertex in the set NP-Complete Outline: 1. Verifier in P 2. Reduction from 3SAT Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

69 Other NP-Complete Problems VERTEX-COVER Given: Undirected Graph G, number k Find: A set of k vertices that touch every edge in G NP-Complete Outline: 1. Verifier in P 2. Reduction from 3SAT Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

70 Other NP-Complete Problems Now What? NP is hard, I give up! NP Problems: a fast algorithm may exist NP-complete Problems: fast (worst-case) not known, maybe not possible? Practical Answer for NP-complete Problems: use a (modern) SAT solver. Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall / 70

Chapter 7: Time Complexity

Chapter 7: Time Complexity Chapter 7: Time Complexity 1 Time complexity Let M be a deterministic Turing machine that halts on all inputs. The running time or time complexity of M is the function f: N N, where f(n) is the maximum

More information

Theory of Computation Time Complexity

Theory of Computation Time Complexity Theory of Computation Time Complexity Bow-Yaw Wang Academia Sinica Spring 2012 Bow-Yaw Wang (Academia Sinica) Time Complexity Spring 2012 1 / 59 Time for Deciding a Language Let us consider A = {0 n 1

More information

TIME COMPLEXITY AND POLYNOMIAL TIME; NON DETERMINISTIC TURING MACHINES AND NP. THURSDAY Mar 20

TIME COMPLEXITY AND POLYNOMIAL TIME; NON DETERMINISTIC TURING MACHINES AND NP. THURSDAY Mar 20 TIME COMPLEXITY AND POLYNOMIAL TIME; NON DETERMINISTIC TURING MACHINES AND NP THURSDAY Mar 20 COMPLEXITY THEORY Studies what can and can t be computed under limited resources such as time, space, etc Today:

More information

CS154, Lecture 13: P vs NP

CS154, Lecture 13: P vs NP CS154, Lecture 13: P vs NP The EXTENDED Church-Turing Thesis Everyone s Intuitive Notion of Efficient Algorithms Polynomial-Time Turing Machines More generally: TM can simulate every reasonable model of

More information

Time Complexity. CS60001: Foundations of Computing Science

Time Complexity. CS60001: Foundations of Computing Science Time Complexity CS60001: Foundations of Computing Science Professor, Dept. of Computer Sc. & Engg., Measuring Complexity Definition Let M be a deterministic Turing machine that halts on all inputs. The

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/ Logistics HW7 due tonight Thursday's class: REVIEW Final exam on Thursday Dec 8, 8am-11am, LEDDN AUD Note card allowed

More information

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete)

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete) CS5371 Theory of Computation Lecture 19: Complexity IV (More on NP, NP-Complete) Objectives More discussion on the class NP Cook-Levin Theorem The Class NP revisited Recall that NP is the class of language

More information

CS154, Lecture 13: P vs NP

CS154, Lecture 13: P vs NP CS154, Lecture 13: P vs NP The EXTENDED Church-Turing Thesis Everyone s Intuitive Notion of Efficient Algorithms Polynomial-Time Turing Machines More generally: TM can simulate every reasonable model of

More information

Time Complexity (1) CSCI Spring Original Slides were written by Dr. Frederick W Maier. CSCI 2670 Time Complexity (1)

Time Complexity (1) CSCI Spring Original Slides were written by Dr. Frederick W Maier. CSCI 2670 Time Complexity (1) Time Complexity (1) CSCI 2670 Original Slides were written by Dr. Frederick W Maier Spring 2014 Time Complexity So far we ve dealt with determining whether or not a problem is decidable. But even if it

More information

CISC 4090 Theory of Computation

CISC 4090 Theory of Computation CISC 4090 Theory of Computation Complexity Professor Daniel Leeds dleeds@fordham.edu JMH 332 Computability Are we guaranteed to get an answer? Complexity How long do we have to wait for an answer? (Ch7)

More information

Lecture 16: Time Complexity and P vs NP

Lecture 16: Time Complexity and P vs NP 6.045 Lecture 16: Time Complexity and P vs NP 1 Time-Bounded Complexity Classes Definition: TIME(t(n)) = { L there is a Turing machine M with time complexity O(t(n)) so that L = L(M) } = { L L is a language

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) Spring l. Blum TIME COMPLEXITY AND POLYNOMIAL TIME;

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) Spring l. Blum TIME COMPLEXITY AND POLYNOMIAL TIME; 15-453 TIME COMPLEXITY AND POLYNOMIAL TIME; FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY NON DETERMINISTIC TURING MACHINES AND NP THURSDAY Mar 20 COMPLEXITY THEORY Studies what can and can t be computed

More information

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT Definition: A language B is NP-complete if: 1. B NP 2. Every A in NP is poly-time reducible to B That is, A P B When this is true, we say B is NP-hard On

More information

CSE 105 Theory of Computation

CSE 105 Theory of Computation CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Today s Agenda P and NP (7.2, 7.3) Next class: Review Reminders and announcements: CAPE & TA evals are open: Please

More information

Finish K-Complexity, Start Time Complexity

Finish K-Complexity, Start Time Complexity 6.045 Finish K-Complexity, Start Time Complexity 1 Kolmogorov Complexity Definition: The shortest description of x, denoted as d(x), is the lexicographically shortest string such that M(w) halts

More information

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem. 1 More on NP In this set of lecture notes, we examine the class NP in more detail. We give a characterization of NP which justifies the guess and verify paradigm, and study the complexity of solving search

More information

Applied Computer Science II Chapter 7: Time Complexity. Prof. Dr. Luc De Raedt. Institut für Informatik Albert-Ludwigs Universität Freiburg Germany

Applied Computer Science II Chapter 7: Time Complexity. Prof. Dr. Luc De Raedt. Institut für Informatik Albert-Ludwigs Universität Freiburg Germany Applied Computer Science II Chapter 7: Time Complexity Prof. Dr. Luc De Raedt Institut für Informati Albert-Ludwigs Universität Freiburg Germany Overview Measuring complexity The class P The class NP NP-completeness

More information

Lecture 3: Nondeterminism, NP, and NP-completeness

Lecture 3: Nondeterminism, NP, and NP-completeness CSE 531: Computational Complexity I Winter 2016 Lecture 3: Nondeterminism, NP, and NP-completeness January 13, 2016 Lecturer: Paul Beame Scribe: Paul Beame 1 Nondeterminism and NP Recall the definition

More information

Complexity: moving from qualitative to quantitative considerations

Complexity: moving from qualitative to quantitative considerations Complexity: moving from qualitative to quantitative considerations Textbook chapter 7 Complexity Theory: study of what is computationally feasible (or tractable) with limited resources: running time (main

More information

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine. The Class NP NP is the problems that can be solved in polynomial time by a nondeterministic machine. NP The time taken by nondeterministic TM is the length of the longest branch. The collection of all

More information

CSE 135: Introduction to Theory of Computation NP-completeness

CSE 135: Introduction to Theory of Computation NP-completeness CSE 135: Introduction to Theory of Computation NP-completeness Sungjin Im University of California, Merced 04-15-2014 Significance of the question if P? NP Perhaps you have heard of (some of) the following

More information

Computational complexity

Computational complexity COMS11700 Computational complexity Department of Computer Science, University of Bristol Bristol, UK 2 May 2014 COMS11700: Computational complexity Slide 1/23 Introduction If we can prove that a language

More information

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch 6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch Today: More Complexity Theory Polynomial-time reducibility, NP-completeness, and the Satisfiability (SAT) problem Topics: Introduction

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 7.2, 7.3 Distinguish between polynomial and exponential DTIME Define nondeterministic

More information

NP-Completeness. A language B is NP-complete iff B NP. This property means B is NP hard

NP-Completeness. A language B is NP-complete iff B NP. This property means B is NP hard NP-Completeness A language B is NP-complete iff B NP A NP A P B This property means B is NP hard 1 3SAT is NP-complete 2 Result Idea: B is known to be NP complete Use it to prove NP-Completeness of C IF

More information

Theory of Computation

Theory of Computation Theory of Computation Dr. Sarmad Abbasi Dr. Sarmad Abbasi () Theory of Computation 1 / 38 Lecture 21: Overview Big-Oh notation. Little-o notation. Time Complexity Classes Non-deterministic TMs The Class

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Ch 7 Distinguish between computability and complexity Articulate motivation questions

More information

Lecture 17: Cook-Levin Theorem, NP-Complete Problems

Lecture 17: Cook-Levin Theorem, NP-Complete Problems 6.045 Lecture 17: Cook-Levin Theorem, NP-Complete Problems 1 Is SAT solvable in O(n) time on a multitape TM? Logic circuits of 6n gates for SAT? If yes, then not only is P=NP, but there would be a dream

More information

CSCI3390-Lecture 16: NP-completeness

CSCI3390-Lecture 16: NP-completeness CSCI3390-Lecture 16: NP-completeness 1 Summary We recall the notion of polynomial-time reducibility. This is just like the reducibility we studied earlier, except that we require that the function mapping

More information

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan August 30, Notes for Lecture 1

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan August 30, Notes for Lecture 1 U.C. Berkeley CS278: Computational Complexity Handout N1 Professor Luca Trevisan August 30, 2004 Notes for Lecture 1 This course assumes CS170, or equivalent, as a prerequisite. We will assume that the

More information

BBM402-Lecture 11: The Class NP

BBM402-Lecture 11: The Class NP BBM402-Lecture 11: The Class NP Lecturer: Lale Özkahya Resources for the presentation: http://ocw.mit.edu/courses/electrical-engineering-andcomputer-science/6-045j-automata-computability-andcomplexity-spring-2011/syllabus/

More information

22c:135 Theory of Computation. Analyzing an Algorithm. Simplifying Conventions. Example computation. How much time does M1 take to decide A?

22c:135 Theory of Computation. Analyzing an Algorithm. Simplifying Conventions. Example computation. How much time does M1 take to decide A? Example computation Consider the decidable language A = {0 n 1 n n 0} and the following TM M1 deciding A: M1 = "On input string w: 1. Scan across the tape and reject if a 0 appears after a 1 2. Repeat

More information

SOLUTION: SOLUTION: SOLUTION:

SOLUTION: SOLUTION: SOLUTION: Convert R and S into nondeterministic finite automata N1 and N2. Given a string s, if we know the states N1 and N2 may reach when s[1...i] has been read, we are able to derive the states N1 and N2 may

More information

COMPLEXITY THEORY. PSPACE = SPACE(n k ) k N. NPSPACE = NSPACE(n k ) 10/30/2012. Space Complexity: Savitch's Theorem and PSPACE- Completeness

COMPLEXITY THEORY. PSPACE = SPACE(n k ) k N. NPSPACE = NSPACE(n k ) 10/30/2012. Space Complexity: Savitch's Theorem and PSPACE- Completeness 15-455 COMPLEXITY THEORY Space Complexity: Savitch's Theorem and PSPACE- Completeness October 30,2012 MEASURING SPACE COMPLEXITY FINITE STATE CONTROL I N P U T 1 2 3 4 5 6 7 8 9 10 We measure space complexity

More information

Polynomial time reduction and NP-completeness. Exploring some time complexity limits of polynomial time algorithmic solutions

Polynomial time reduction and NP-completeness. Exploring some time complexity limits of polynomial time algorithmic solutions Polynomial time reduction and NP-completeness Exploring some time complexity limits of polynomial time algorithmic solutions 1 Polynomial time reduction Definition: A language L is said to be polynomial

More information

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer Science University of Virginia www.cs.virginia.edu/~njb2b/theory

More information

P, NP, NP-Complete, and NPhard

P, NP, NP-Complete, and NPhard P, NP, NP-Complete, and NPhard Problems Zhenjiang Li 21/09/2011 Outline Algorithm time complicity P and NP problems NP-Complete and NP-Hard problems Algorithm time complicity Outline What is this course

More information

Advanced topic: Space complexity

Advanced topic: Space complexity Advanced topic: Space complexity CSCI 3130 Formal Languages and Automata Theory Siu On CHAN Chinese University of Hong Kong Fall 2016 1/28 Review: time complexity We have looked at how long it takes to

More information

Chapter 2 : Time complexity

Chapter 2 : Time complexity Dr. Abhijit Das, Chapter 2 : Time complexity In this chapter we study some basic results on the time complexities of computational problems. concentrate our attention mostly on polynomial time complexities,

More information

Computability Theory

Computability Theory CS:4330 Theory of Computation Spring 2018 Computability Theory P versus NP and NP-Completeness Haniel Barbosa Readings for this lecture Chapter 7 of [Sipser 1996], 3rd edition. Section 7.4. The P versus

More information

Lecture 22: PSPACE

Lecture 22: PSPACE 6.045 Lecture 22: PSPACE 1 VOTE VOTE VOTE For your favorite course on automata and complexity Please complete the online subject evaluation for 6.045 2 Final Exam Information Who: You On What: Everything

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Lecture 10 More examples of problems in P Closure properties of the class P The class NP given by Jiri Srba Lecture 10 Computability and Complexity 1/12 Example: Relatively

More information

Computability Theory

Computability Theory CS:4330 Theory of Computation Spring 2018 Computability Theory The class NP Haniel Barbosa Readings for this lecture Chapter 7 of [Sipser 1996], 3rd edition. Section 7.3. Question Why are we unsuccessful

More information

Correctness of Dijkstra s algorithm

Correctness of Dijkstra s algorithm Correctness of Dijkstra s algorithm Invariant: When vertex u is deleted from the priority queue, d[u] is the correct length of the shortest path from the source s to vertex u. Additionally, the value d[u]

More information

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete CS125 Lecture 15 Fall 2016 15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete Already know SAT NP, so only need to show SAT is NP-hard. Let L be any language in NP. Let M be a NTM that decides L

More information

Intro to Theory of Computation

Intro to Theory of Computation Intro to Theory of Computation LECTURE 25 Last time Class NP Today Polynomial-time reductions Adam Smith; Sofya Raskhodnikova 4/18/2016 L25.1 The classes P and NP P is the class of languages decidable

More information

More Turing Machines. CS154 Chris Pollett Mar 15, 2006.

More Turing Machines. CS154 Chris Pollett Mar 15, 2006. More Turing Machines CS154 Chris Pollett Mar 15, 2006. Outline Multitape Turing Machines Nondeterministic Turing Machines Enumerators Introduction There have been many different proposals for what it means

More information

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office? N P NP Completeness Announcements Friday Four Square! Today at 4:15PM, outside Gates. Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Explore P, NP, and their connection. Did

More information

NP, polynomial-time mapping reductions, and NP-completeness

NP, polynomial-time mapping reductions, and NP-completeness NP, polynomial-time mapping reductions, and NP-completeness In the previous lecture we discussed deterministic time complexity, along with the time-hierarchy theorem, and introduced two complexity classes:

More information

Space Complexity. The space complexity of a program is how much memory it uses.

Space Complexity. The space complexity of a program is how much memory it uses. Space Complexity The space complexity of a program is how much memory it uses. Measuring Space When we compute the space used by a TM, we do not count the input (think of input as readonly). We say that

More information

CS294: Pseudorandomness and Combinatorial Constructions September 13, Notes for Lecture 5

CS294: Pseudorandomness and Combinatorial Constructions September 13, Notes for Lecture 5 UC Berkeley Handout N5 CS94: Pseudorandomness and Combinatorial Constructions September 3, 005 Professor Luca Trevisan Scribe: Gatis Midrijanis Notes for Lecture 5 In the few lectures we are going to look

More information

Lecture 25: Cook s Theorem (1997) Steven Skiena. skiena

Lecture 25: Cook s Theorem (1997) Steven Skiena.   skiena Lecture 25: Cook s Theorem (1997) Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Prove that Hamiltonian Path is NP

More information

Advanced Topics in Theoretical Computer Science

Advanced Topics in Theoretical Computer Science Advanced Topics in Theoretical Computer Science Part 5: Complexity (Part II) 30.01.2014 Viorica Sofronie-Stokkermans Universität Koblenz-Landau e-mail: sofronie@uni-koblenz.de 1 Contents Recall: Turing

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY THURSDAY APRIL 3 REVIEW for Midterm TUESDAY April 8 Definition: A Turing Machine is a 7-tuple T = (Q, Σ, Γ, δ, q, q accept, q reject ), where: Q is a

More information

Asymptotic notation : big-o and small-o

Asymptotic notation : big-o and small-o Time complexity Here we will consider elements of computational complexity theory an investigation of the time (or other resources) required for solving computational problems. We introduce a way of measuring

More information

Computability Theory. CS215, Lecture 6,

Computability Theory. CS215, Lecture 6, Computability Theory CS215, Lecture 6, 2000 1 The Birth of Turing Machines At the end of the 19th century, Gottlob Frege conjectured that mathematics could be built from fundamental logic In 1900 David

More information

P and NP. Or, how to make $1,000,000.

P and NP. Or, how to make $1,000,000. P and NP Or, how to make $1,000,000. http://www.claymath.org/millennium-problems/p-vs-np-problem Review: Polynomial time difference between single-tape and multi-tape TMs Exponential time difference between

More information

Theory of Computation CS3102 Spring 2015 A tale of computers, math, problem solving, life, love and tragic death

Theory of Computation CS3102 Spring 2015 A tale of computers, math, problem solving, life, love and tragic death Theory of Computation CS3102 Spring 2015 A tale of computers, math, problem solving, life, love and tragic death Robbie Hott www.cs.virginia.edu/~jh2jf Department of Computer Science University of Virginia

More information

Notes for Lecture Notes 2

Notes for Lecture Notes 2 Stanford University CS254: Computational Complexity Notes 2 Luca Trevisan January 11, 2012 Notes for Lecture Notes 2 In this lecture we define NP, we state the P versus NP problem, we prove that its formulation

More information

Intro to Theory of Computation

Intro to Theory of Computation Intro to Theory of Computation LECTURE 22 Last time Review Today: Finish recursion theorem Complexity theory Exam 2 solutions out Homework 9 out Sofya Raskhodnikova L22.1 I-clicker question (frequency:

More information

Computational Complexity

Computational Complexity CS311 Computational Structures Computational Complexity Lecture 16 Andrew P. Black Andrew Tolmach 1 So, itʼs computable! But at what cost? Some things that are computable in principle are in practice intractable

More information

Theory of Computation. Ch.8 Space Complexity. wherein all branches of its computation halt on all

Theory of Computation. Ch.8 Space Complexity. wherein all branches of its computation halt on all Definition 8.1 Let M be a deterministic Turing machine, DTM, that halts on all inputs. The space complexity of M is the function f : N N, where f(n) is the maximum number of tape cells that M scans on

More information

Introduction to Complexity Theory

Introduction to Complexity Theory Introduction to Complexity Theory Read K & S Chapter 6. Most computational problems you will face your life are solvable (decidable). We have yet to address whether a problem is easy or hard. Complexity

More information

The Cook-Levin Theorem

The Cook-Levin Theorem An Exposition Sandip Sinha Anamay Chaturvedi Indian Institute of Science, Bangalore 14th November 14 Introduction Deciding a Language Let L {0, 1} be a language, and let M be a Turing machine. We say M

More information

Turing Machines and Time Complexity

Turing Machines and Time Complexity Turing Machines and Time Complexity Turing Machines Turing Machines (Infinitely long) Tape of 1 s and 0 s Turing Machines (Infinitely long) Tape of 1 s and 0 s Able to read and write the tape, and move

More information

Friday Four Square! Today at 4:15PM, Outside Gates

Friday Four Square! Today at 4:15PM, Outside Gates P and NP Friday Four Square! Today at 4:15PM, Outside Gates Recap from Last Time Regular Languages DCFLs CFLs Efficiently Decidable Languages R Undecidable Languages Time Complexity A step of a Turing

More information

Welcome to... Problem Analysis and Complexity Theory , 3 VU

Welcome to... Problem Analysis and Complexity Theory , 3 VU Welcome to... Problem Analysis and Complexity Theory 716.054, 3 VU Birgit Vogtenhuber Institute for Software Technology email: bvogt@ist.tugraz.at office: Inffeldgasse 16B/II, room IC02044 slides: http://www.ist.tugraz.at/pact17.html

More information

Lecture 18: PCP Theorem and Hardness of Approximation I

Lecture 18: PCP Theorem and Hardness of Approximation I Lecture 18: and Hardness of Approximation I Arijit Bishnu 26.04.2010 Outline 1 Introduction to Approximation Algorithm 2 Outline 1 Introduction to Approximation Algorithm 2 Approximation Algorithm Approximation

More information

NP Complete Problems. COMP 215 Lecture 20

NP Complete Problems. COMP 215 Lecture 20 NP Complete Problems COMP 215 Lecture 20 Complexity Theory Complexity theory is a research area unto itself. The central project is classifying problems as either tractable or intractable. Tractable Worst

More information

Computability and Complexity CISC462, Fall 2018, Space complexity 1

Computability and Complexity CISC462, Fall 2018, Space complexity 1 Computability and Complexity CISC462, Fall 2018, Space complexity 1 SPACE COMPLEXITY This material is covered in Chapter 8 of the textbook. For simplicity, we define the space used by a Turing machine

More information

Logarithmic space. Evgenij Thorstensen V18. Evgenij Thorstensen Logarithmic space V18 1 / 18

Logarithmic space. Evgenij Thorstensen V18. Evgenij Thorstensen Logarithmic space V18 1 / 18 Logarithmic space Evgenij Thorstensen V18 Evgenij Thorstensen Logarithmic space V18 1 / 18 Journey below Unlike for time, it makes sense to talk about sublinear space. This models computations on input

More information

1 Computational Problems

1 Computational Problems Stanford University CS254: Computational Complexity Handout 2 Luca Trevisan March 31, 2010 Last revised 4/29/2010 In this lecture we define NP, we state the P versus NP problem, we prove that its formulation

More information

Lecture 19: Finish NP-Completeness, conp and Friends

Lecture 19: Finish NP-Completeness, conp and Friends 6.045 Lecture 19: Finish NP-Completeness, conp and Friends 1 Polynomial Time Reducibility f : Σ* Σ* is a polynomial time computable function if there is a poly-time Turing machine M that on every input

More information

CS154, Lecture 17: conp, Oracles again, Space Complexity

CS154, Lecture 17: conp, Oracles again, Space Complexity CS154, Lecture 17: conp, Oracles again, Space Complexity Definition: conp = { L L NP } What does a conp computation look like? In NP algorithms, we can use a guess instruction in pseudocode: Guess string

More information

Week 2: Defining Computation

Week 2: Defining Computation Computational Complexity Theory Summer HSSP 2018 Week 2: Defining Computation Dylan Hendrickson MIT Educational Studies Program 2.1 Turing Machines Turing machines provide a simple, clearly defined way

More information

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler Complexity Theory Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 15 May, 2018 Reinhard

More information

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181. Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität

More information

CSCI 1590 Intro to Computational Complexity

CSCI 1590 Intro to Computational Complexity CSCI 1590 Intro to Computational Complexity Space Complexity John E. Savage Brown University February 11, 2008 John E. Savage (Brown University) CSCI 1590 Intro to Computational Complexity February 11,

More information

Computational Models Lecture 11, Spring 2009

Computational Models Lecture 11, Spring 2009 Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models Lecture 11, Spring 2009 Deterministic Time Classes NonDeterministic Time Classes

More information

Time to learn about NP-completeness!

Time to learn about NP-completeness! Time to learn about NP-completeness! Harvey Mudd College March 19, 2007 Languages A language is a set of strings Examples The language of strings of all a s with odd length The language of strings with

More information

Space Complexity. Huan Long. Shanghai Jiao Tong University

Space Complexity. Huan Long. Shanghai Jiao Tong University Space Complexity Huan Long Shanghai Jiao Tong University Acknowledgements Part of the slides comes from a similar course in Fudan University given by Prof. Yijia Chen. http://basics.sjtu.edu.cn/ chen/

More information

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes Complexity Theory 1 Complexity Theory 2 Complexity Theory Lecture 3 Complexity For any function f : IN IN, we say that a language L is in TIME(f(n)) if there is a machine M = (Q, Σ, s, δ), such that: L

More information

1 Non-deterministic Turing Machine

1 Non-deterministic Turing Machine 1 Non-deterministic Turing Machine A nondeterministic Turing machine is a generalization of the standard TM for which every configuration may yield none, or one or more than one next configurations. In

More information

CSCI3390-Second Test with Solutions

CSCI3390-Second Test with Solutions CSCI3390-Second Test with Solutions April 26, 2016 Each of the 15 parts of the problems below is worth 10 points, except for the more involved 4(d), which is worth 20. A perfect score is 100: if your score

More information

CP405 Theory of Computation

CP405 Theory of Computation CP405 Theory of Computation BB(3) q 0 q 1 q 2 0 q 1 1R q 2 0R q 2 1L 1 H1R q 1 1R q 0 1L Growing Fast BB(3) = 6 BB(4) = 13 BB(5) = 4098 BB(6) = 3.515 x 10 18267 (known) (known) (possible) (possible) Language:

More information

Week 3: Reductions and Completeness

Week 3: Reductions and Completeness Computational Complexity Theory Summer HSSP 2018 Week 3: Reductions and Completeness Dylan Hendrickson MIT Educational Studies Program 3.1 Reductions Suppose I know how to solve some problem quickly. How

More information

Polynomial Time Computation. Topics in Logic and Complexity Handout 2. Nondeterministic Polynomial Time. Succinct Certificates.

Polynomial Time Computation. Topics in Logic and Complexity Handout 2. Nondeterministic Polynomial Time. Succinct Certificates. 1 2 Topics in Logic and Complexity Handout 2 Anuj Dawar MPhil Advanced Computer Science, Lent 2010 Polynomial Time Computation P = TIME(n k ) k=1 The class of languages decidable in polynomial time. The

More information

Chapter 1 - Time and Space Complexity. deterministic and non-deterministic Turing machine time and space complexity classes P, NP, PSPACE, NPSPACE

Chapter 1 - Time and Space Complexity. deterministic and non-deterministic Turing machine time and space complexity classes P, NP, PSPACE, NPSPACE Chapter 1 - Time and Space Complexity deterministic and non-deterministic Turing machine time and space complexity classes P, NP, PSPACE, NPSPACE 1 / 41 Deterministic Turing machines Definition 1.1 A (deterministic

More information

CS20a: NP completeness. NP-complete definition. Related properties. Cook's Theorem

CS20a: NP completeness. NP-complete definition. Related properties. Cook's Theorem CS20a: NP completeness Cook s theorem SAT is an NP-complete problem http://www.cs.caltech.edu/courses/cs20/a/ December 2, 2002 1 NP-complete definition A problem is in NP if it can be solved by a nondeterministic

More information

CS151 Complexity Theory. Lecture 1 April 3, 2017

CS151 Complexity Theory. Lecture 1 April 3, 2017 CS151 Complexity Theory Lecture 1 April 3, 2017 Complexity Theory Classify problems according to the computational resources required running time storage space parallelism randomness rounds of interaction,

More information

Time to learn about NP-completeness!

Time to learn about NP-completeness! Time to learn about NP-completeness! Harvey Mudd College March 19, 2007 Languages A language is a set of strings Examples The language of strings of all zeros with odd length The language of strings with

More information

Limitations of Algorithm Power

Limitations of Algorithm Power Limitations of Algorithm Power Objectives We now move into the third and final major theme for this course. 1. Tools for analyzing algorithms. 2. Design strategies for designing algorithms. 3. Identifying

More information

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

CSE 555 HW 5 SAMPLE SOLUTION. Question 1. CSE 555 HW 5 SAMPLE SOLUTION Question 1. Show that if L is PSPACE-complete, then L is NP-hard. Show that the converse is not true. If L is PSPACE-complete, then for all A PSPACE, A P L. We know SAT PSPACE

More information

MTAT Complexity Theory October 13th-14th, Lecture 6

MTAT Complexity Theory October 13th-14th, Lecture 6 MTAT.07.004 Complexity Theory October 13th-14th, 2011 Lecturer: Peeter Laud Lecture 6 Scribe(s): Riivo Talviste 1 Logarithmic memory Turing machines working in logarithmic space become interesting when

More information

MTAT Complexity Theory September 15th, Lecture 3

MTAT Complexity Theory September 15th, Lecture 3 MTAT.07.004 Complexity Theory September 15th, 2011 Lecturer: Peeter Laud Lecture 3 Scribe(s): Ilya Kuzovkin Introduction During this lecture we went through proofs for four theorems. Multi-tape Turing

More information

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015 CS 374: Algorithms & Models of Computation, Spring 2015 NP Completeness Lecture 23 November 19, 2015 Chandra & Lenny (UIUC) CS374 1 Spring 2015 1 / 37 Part I NP-Completeness Chandra & Lenny (UIUC) CS374

More information

CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010

CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010 CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010 Computational complexity studies the amount of resources necessary to perform given computations.

More information

Could we potentially place A in a smaller complexity class if we consider other computational models?

Could we potentially place A in a smaller complexity class if we consider other computational models? Introduction to Complexity Theory Big O Notation Review Linear function: r(n) =O(n). Polynomial function: r(n) =2 O(1) Exponential function: r(n) =2 no(1) Logarithmic function: r(n) = O(log n) Poly-log

More information

Definition: conp = { L L NP } What does a conp computation look like?

Definition: conp = { L L NP } What does a conp computation look like? Space Complexity 28 Definition: conp = { L L NP } What does a conp computation look like? In NP algorithms, we can use a guess instruction in pseudocode: Guess string y of x k length and the machine accepts

More information