CSE 105 THEORY OF COMPUTATION

Similar documents
CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CSE 105 Theory of Computation

Time Complexity. CS60001: Foundations of Computing Science

CISC 4090 Theory of Computation

CSE 105 THEORY OF COMPUTATION

Chapter 7: Time Complexity

CS154, Lecture 13: P vs NP

Computability and Complexity

CS154, Lecture 13: P vs NP

Computational Models Lecture 11, Spring 2009

Theory of Computation Time Complexity

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

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

Computability Theory

Lecture 16: Time Complexity and P vs NP

CSE 105 THEORY OF COMPUTATION

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

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

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

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

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

Finish K-Complexity, Start Time Complexity

CSE 135: Introduction to Theory of Computation NP-completeness

Complexity (Pre Lecture)

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

Lecture 19: Finish NP-Completeness, conp and Friends

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

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

Chapter 2 : Time complexity

BBM402-Lecture 11: The Class NP

Intro to Theory of Computation

NP Complete Problems. COMP 215 Lecture 20

CS5371 Theory of Computation. Lecture 18: Complexity III (Two Classes: P and NP)

Lecture 3: Nondeterminism, NP, and NP-completeness

Computational complexity

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

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P

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

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

CP405 Theory of Computation

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Design and Analysis of Algorithms

Intractable Problems [HMU06,Chp.10a]

1 Non-deterministic Turing Machine

Advanced Topics in Theoretical Computer Science

NP-Complete Reductions 1

Intro to Theory of Computation

Lecture 18: PCP Theorem and Hardness of Approximation I

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

Introduction to Complexity Theory

Correctness of Dijkstra s algorithm

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

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

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

NP Completeness and Approximation Algorithms

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

P vs. NP Classes. Prof. (Dr.) K.R. Chowdhary.

Announcements. Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved!

The P versus NP Problem. Dean Casalena University of Cape Town CSLDEA001

Complexity Theory Part I

The Cook-Levin Theorem

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?

Complexity: moving from qualitative to quantitative considerations

Computability Theory

CS Lecture 28 P, NP, and NP-Completeness. Fall 2008

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

Computational Complexity

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

Algorithms and Theory of Computation. Lecture 19: Class P and NP, Reduction

Agenda. What is a complexity class? What are the important complexity classes? How do you prove an algorithm is in a certain class

P, NP, NP-Complete, and NPhard

q FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) Spring L. Blum. REVIEW for Midterm 2 TURING MACHINE

CS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP

NP-Complete Problems. More reductions

ECE 695 Numerical Simulations Lecture 2: Computability and NPhardness. Prof. Peter Bermel January 11, 2017

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

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

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k.

There are two types of problems:

conp, Oracles, Space Complexity

Chapter 34: NP-Completeness

CSE 105 THEORY OF COMPUTATION

Complexity Theory Part I

10.3: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine.

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions

Limits of Feasibility. Example. Complexity Relationships among Models. 1. Complexity Relationships among Models

NP-Completeness and Boolean Satisfiability

Computational complexity theory

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

Complexity, P and NP

NP-Completeness. NP-Completeness 1

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

Intractable Problems. Time-Bounded Turing Machines Classes P and NP Polynomial-Time Reductions

1. Introduction Recap

1 Computational Problems

CSL 356: Analysis and Design of Algorithms. Ragesh Jaiswal CSE, IIT Delhi

CSE 105 THEORY OF COMPUTATION

Transcription:

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 running time Analyse an algorithm to determine whether it is in P Define the class NP Analyse a nondeterministic algorithm to determine whether it is in NP List some famous problems in P List some famous problems in NP State and explain P=NP? Define NP-completeness Explain the connection between P=NP? and NP-completeness

Announcements Final exam review In class on Thursday Evening session Thursday CAPE and TA evaluations open Final exam study guide + seat assignments on Ted Final Saturday June 4 11:30am-2:29pm PETERSON 108 1 note sheet, may be 5x8, no magnifying glass!

Measuring time Sipser p. 251 For a given algorithm working on a given input, how long do we need to wait for an answer? Count steps! For a problem decided by a given algorithm, how does the running time depend on the input in the worst-case? average-case? Big-O What's in common among all problems that are efficiently solvable? Time(t(n))

Time complexity classes TIME(t(n)) = { L L is decidable by a TM running in O(t(n)) } Exponential Polynomial Logarithmic Brute-force search Invariant under many models of TMs May not need to read all of input

Which machine model? q0 q0 deterministic computation nondeterministic computation q rej q acc q acc q rej q rej

Time complexity For M a deterministic decider, its running time or time complexity is the function f: N R + given by f(n) = maximum number of steps M takes before halting, over all inputs of length n. For M a nondeterministic decider, its running time or time complexity is the function f: N R + given by f(n) = maximum number of steps M takes before halting on any branch of its computation, over all inputs of length n.

Time complexity classes DTIME ( t(n) ) = { L L is decidable by O( t(n) ) deterministic, single-tape TM } NTIME ( t(n) ) = { L L is decidable by O( t(n) ) nondeterministic, single-tape TM } Is DTIME(n 2 ) a subset of DTIME(n 3 )? A. Yes B. No C. Not enough information to decide D. I don't know

Time complexity classes DTIME ( t(n) ) = { L L is decidable by O( t(n) ) deterministic, single-tape TM } NTIME ( t(n) ) = { L L is decidable by O( t(n) ) nondeterministic, single-tape TM } Is DTIME(n 2 ) a subset of NTIME(n 2 )? A. Yes B. No C. Not enough information to decide D. I don't know

Time complexity classes DTIME ( t(n) ) = { L L is decidable by O( t(n) ) deterministic, single-tape TM } NTIME ( t(n) ) = { L L is decidable by O( t(n) ) nondeterministic, single-tape TM } Is NTIME(n 2 ) a subset of DTIME(n 2 )? A. Yes B. No C. Not enough information to decide D. I don't know

"Feasible" i.e. P Can't use nondeterminism Can use multiple tapes Often need to be "more clever" than naïve / brute force approach Examples PATH = {<G,s,t> G is digraph with n nodes there is path from s to t} RELPRIME = { <x,y> x and y are relatively prime integers} Use Euclidean Algorithm to show in P L(G) = {w w is generated by G} where G is any CFG Use Dynamic Programming to show in P

"Verifiable" i.e. NP Best known solution is brute-force Look for some "certificate" if had one, could check if it works quickly P = NP?

Examples in NP for graphs Sipser p. 264,268,284 HAMPATH = { <G,s,t> G is digraph with a path from s to t that goes through every node exactly once } CLIQUE = { <G,k> G is an undirected graph with a k-clique } VERTEX-COVER = { <G,k> G is an undirected graph with a Subset of k nodes s.t. each edge incident with one of them Complete subgraph with k nodes k-node vertex cover}

Examples in NP for graphs Sipser p. 264,268,284 CLIQUE = { <G,k> G is an undirected graph with a k-clique } Complete subgraph with k nodes How many possible k-cliques are there? How long does it take to confirm "clique-ness"? A. O(n n ), O(n 2 ) B. O(2 n ), O(n) C. O(n!), O(log n) D. O(n), O(n) E. I don't know

Examples in NP optimization Sipser p. 264,268 TSP = { <G,k> G is complete weighted undirected graph where weight between node i and node j is "distance" between them; there is a tour of all cities with total distance less than k } How many possible tours are there? How long does it take to check the distance of a single tour? A. O(n 2 ), O(n) B. O(2 n ), O(n 2 ) C. O(n n ), O(log n) D. O(n!), O(n) E. I don't know

Examples in NP for numbers Sipser p. 265,269 COMPOSITES = { x x is an integer >2 and is not prime} SUBSET-SUM = { <S,t> S={x 1,..,x k } and some subset sums to t}

Examples in NP for logic Sipser p. 271 SAT = { <φ> φ is a satisfiable Boolean formula } Is < > in SAT? A. Yes B. No C. Not enough information to decide D. I don't know

P vs. NP Problems in P (Membership in any) CFL PATH E DFA EQ DFA Addition, multiplication of integers Problems in NP Any problem in P HAMPATH CLIQUE VERTEX-COVER TSP SAT

Decidable NP? P CF Regular

Reductions to the rescue Sipser p. 271,276 1970s Stephen Cook and Leonid Levin indepdendently and in parallel lay foundations of NP-completeness Intuitively: if an NP-complete problem has a polynomial algorithm, then all NP problems are polynomail time solvable. A language B is NP-complete if it is in NP and every A in NP is polynomial-time reducible to it. Cook-Levin Theorem: SAT is NP-complete.

What would prove that P = NP? 1970s Stephen Cook and B. Leonid Showing Levin that there indepdendently are two distinct and NP-in parallel lay foundations of NP-completeness problems. Intuitively: if an NP-complete problem has a polynomial algorithm, then all NP problems are polynomail time solvable. A language B is NP-complete if it is in NP and every A in NP is polynomial-time reducible to it. Cook-Levin Theorem: SAT is NP-complete. Reductions to the rescue A. Showing that a problem solvable Sipser by p. 271,276 bruteforce methods has a nondeterministic solution. C. Finding a polynomial time solution for an NPcomplete problem. D. Proving that an NP-complete problem is not solvable in polynomial time. E. I don't know