Algorithms and Data Structures Final Lesson

Size: px
Start display at page:

Download "Algorithms and Data Structures Final Lesson"

Transcription

1 Algorithms and Data Structures Final Lesson Michael Schwarzkopf weimar.de/de/medien/professuren/medieninformatik/grafische datenverarbeitung Bauhaus University Weimar July 11, 2018 (Corrected minor mistakes on July 12)

2 Overview...of things you should definetely know about if you want a very good grade Mathematical Interpolation Lagrange Spline Minimum Squares Integration NP Complete Traveling salesman Hamiltonian circle Satisfiability Clique } Reduction

3 Interpolation Basically: We have some Points & search for a polynom function passing through the Points. Magic (Lagrange)

4 Interpolation Seems that we found a solution to all our problems. Lets try again :) Seems that the Graph should stay somewhere inside the red area around y = 3.

5 Interpolation Seems that we found a solution to all our problems. Lets try again :( Using Lagrange interpol. the graph completely freaks out. Its because of the high degree

6 Linear Spline Interpolation We could just keep things simple and make a piecewise linear function: Lines, where Y value matches in each point Not only looks bad but is also not differentiable at matching points Need better approach

7 Cubic Spline Interpolation Most common: use Splines of degree 3 Curves, where Y value matches in each point Also first and second derivative have to match

8 Cubic Spline Interpolation Most common: use Splines of degree 3 Note that between each two points there are different polynomials of degree 3 Advantage: we can differentiate twice at each point!

9 Minimum Squares (Line) What if we really assume one linear function? If points are measurement results and there are Errors Search for a Function which is as close as possible to each point We want the red line so that the sum over the sqares of the blue lines is minimal

10 Minimum Squares (Line) Let pi be the Y coordinate of each given Point Let yi be the Point on the line lying vertically above pi The length of each blue line is yi pi So we want (yi pi)² to be minimal.

11 Minimum Squares (Line) Usage: No mathematical background now. Just do the following: List corresponding x and y values: Xi Yi Set Matrix: Set Vector:

12 Minimum Squares (Line) Solve: for n and m In our case: So we get: n = 3.14, m = 0.034

13 Minimum Squares (Line) f(x) = x : Good job. German: mathe.de/buch/matrizen/methode der kleinsten quadrate/

14 Minimum Squares (Parabola) Another set of values: Just look; Wouldn t make any sense to lay a line through this. Instead we expand the known way to the next dimension.

15 Minimum Squares (Parabola) Calculate A differently: You ll get a square function Calculation of B stays the same. Get You can adapt this to functions of higher degrees! f(x) = ax² + bx + c doing

16 Discrete/Numerical Intgration Those two are easy. Just keep them im mind: Trapezoids Rectangles

17 Discrete/Numerical Intgration Simpson Rule For Simpson Rule let s do an example: Let: f(x) = xx f(x) dx is not generally defined For this example, let (xi+1 xi ) = h constant

18 Discrete/Numerical Intgration Simpson Rule So for f(x) = xx let x1 = 1, x2 = 2, x3 = 3 : Software solution: very close!

19 Introduction: Compexity Theory NP Complete Problems Lets get to another Topic Is anyone interested in a Million dollars? So listen.

20 Introduction: Compexity Theory NP Complete Problems All algoritms we saw worked deterministically after each step, another certain step is defined. We could solve all presented problems more or less efficiently, but all in Polynomial Time That means, for each Algorithm, there is some Polynomial working as an upper bound. O(n log(n)) < n * n0.5 = O(n1.5) (Sorting) O(n * m) <n*n = O(n²) (Wrapping) We define a class P where all problems which fulfill this property are part of.

21 Introduction: Compexity Theory NP Complete Problems At each step a machine is in a certain state & goes into another after it. Like in tree traversal: If there s a right child: Go to the right else: Go to the left Output the node value Now imagine a machine, going into different states (left, right...) at the same time You d say, this machine works non deterministically

22 Traveling Salesman Problem (TSP) Def: Shortest path in a complete weigted graph passing all nodes and ending at its start point* *not te accurate definition but serves the purpose.

23 Non deterministic Algorithm The non deterministic algorithm can check each edge connected to s, using one step.

24 Non deterministic Algorithm In the next step, from each of the different states (blue), it goes into all possible states from there (red) Note that all these four operations happen in step 2 at the same time!

25 Non deterministic Algorithm Eventually the Algorithm finds the solution for Travelling Salesman Problem in V steps. Checking the correctness of the solution happens deterministically again and needs polynomial time. The class of all Problems solvable by a Non deterministic Algorithm in Polynomial time is called NP Not only is TSP in NP, it s proven that there are no harder problems in this class. (but equally hard ones)

26 P vs NP Until now, nobody found a deterministic algorithm in polynomial time solving TSP. They are all in exponential runtime ( O(constn) ) However, nobody could prove, there is none If you can prove one of those two cases, the CMI pays you a price of 1 Million US Dollars Good luck!

27 Proving NP Completeness As stated before, TSP is as hard as a NP problem can be it s NP Complete Proving NP Completeness is not as hard if you know one NP Complete Problem Considering another problem, you just have to modify it so that, if you can solve this problem, you can solve the other one. This modification is called reduction

28 Hamiltonian Cycle (HAM) Def: Given an undirected, unwighted Graph. Is there a cycle visting all vertices once?

29 Reduction We will show: If we can solve HAM, than we can modify the solution to solve TSP This tells us, that HAM is NP complete too Does this guy have a Hamiltonian Cycle in it?

30 Reduction TSP is defined on weigted graphs, so add weight 1 to all exising edges: TSP is definded on complete graphs, so add edges, but with higher weight:

31 Reduction If we can solve HAM on this: We can solve TSP with length = 5 on this: As TSP is NP Complete, HAM is as well.

32 Satisfiability (SAT) As someone could ask you for further NPC problems, let s present two more: Def. SAT: Given a Boolean expression (not, or, and, variables), is there a way to choose the variables such that the expression is true? True for: x1 = 0, x2 = 0, x3 = 1, x4 = 1 Proven to be NP Complete if there are 3 or more variables inside the Parentheses (3 SAT)

33 CLIQUE Given a simple Graph and a number n. Is there some combination of n or more Vertices so that these form a complete Graph? House of Santa has a 3 CLIQUE NP Complete for bigger graphs House of Nicolaus even has a 4 CLIQUE

34 Conclusion There are infinetely many NP Complete problems If you can solve one in P, you can solve all in P using reduction Hopefully, if someone asks you to present 4 NPC problems, you know exactly what to do: Traveling salesman Hamiltonian circle Satisfiability Clique complete_problems

35 Exam preparation If you get stuck understanding an Algorithm, don t waste too much time & ask me! Nobody knows at the moment, which questions appear on the exam. But most frequent topics are: Sorting (6 Algorithms) Spanning Tree (Prim & Kruskal) Hashing (1 Problem, 3 Solutions) String Searching (3 Algorithms)

36 Good... Luck is not what you need in the Exam. I wish you good strength and concentration...and maybe even fun.

NP-Completeness. Until now we have been designing algorithms for specific problems

NP-Completeness. Until now we have been designing algorithms for specific problems NP-Completeness 1 Introduction Until now we have been designing algorithms for specific problems We have seen running times O(log n), O(n), O(n log n), O(n 2 ), O(n 3 )... We have also discussed lower

More information

Data Structures in Java

Data Structures in Java Data Structures in Java Lecture 21: Introduction to NP-Completeness 12/9/2015 Daniel Bauer Algorithms and Problem Solving Purpose of algorithms: find solutions to problems. Data Structures provide ways

More information

Introduction to Computational Complexity

Introduction to Computational Complexity Introduction to Computational Complexity Tandy Warnow October 30, 2018 CS 173, Introduction to Computational Complexity Tandy Warnow Overview Topics: Solving problems using oracles Proving the answer to

More information

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1 NP CS 320, Fall 2017 Dr. Geri Georg, Instructor georg@colostate.edu 320 NP 1 NP Complete A class of problems where: No polynomial time algorithm has been discovered No proof that one doesn t exist 320

More information

CMSC 441: Algorithms. NP Completeness

CMSC 441: Algorithms. NP Completeness CMSC 441: Algorithms NP Completeness Intractable & Tractable Problems Intractable problems: As they grow large, we are unable to solve them in reasonable time What constitutes reasonable time? Standard

More information

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

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University NP-Completeness CptS 223 Advanced Data Structures Larry Holder School of Electrical Engineering and Computer Science Washington State University 1 Hard Graph Problems Hard means no known solutions with

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms Session 21. April 13, 2009 Instructor: Bert Huang http://www.cs.columbia.edu/~bert/courses/3137 Announcements Homework 5 due next Monday I m out of town Wed to Sun for conference

More information

NP-Complete Problems. More reductions

NP-Complete Problems. More reductions NP-Complete Problems More reductions Definitions P: problems that can be solved in polynomial time (typically in n, size of input) on a deterministic Turing machine Any normal computer simulates a DTM

More information

VIII. NP-completeness

VIII. NP-completeness VIII. NP-completeness 1 / 15 NP-Completeness Overview 1. Introduction 2. P and NP 3. NP-complete (NPC): formal definition 4. How to prove a problem is NPC 5. How to solve a NPC problem: approximate algorithms

More information

CS/COE

CS/COE CS/COE 1501 www.cs.pitt.edu/~nlf4/cs1501/ P vs NP But first, something completely different... Some computational problems are unsolvable No algorithm can be written that will always produce the correct

More information

Cubic Splines MATH 375. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Cubic Splines

Cubic Splines MATH 375. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Cubic Splines Cubic Splines MATH 375 J. Robert Buchanan Department of Mathematics Fall 2006 Introduction Given data {(x 0, f(x 0 )), (x 1, f(x 1 )),...,(x n, f(x n ))} which we wish to interpolate using a polynomial...

More information

Chapter 34: NP-Completeness

Chapter 34: NP-Completeness Graph Algorithms - Spring 2011 Set 17. Lecturer: Huilan Chang Reference: Cormen, Leiserson, Rivest, and Stein, Introduction to Algorithms, 2nd Edition, The MIT Press. Chapter 34: NP-Completeness 2. Polynomial-time

More information

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

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P Easy Problems vs. Hard Problems CSE 421 Introduction to Algorithms Winter 2000 NP-Completeness (Chapter 11) Easy - problems whose worst case running time is bounded by some polynomial in the size of the

More information

Computational Complexity. IE 496 Lecture 6. Dr. Ted Ralphs

Computational Complexity. IE 496 Lecture 6. Dr. Ted Ralphs Computational Complexity IE 496 Lecture 6 Dr. Ted Ralphs IE496 Lecture 6 1 Reading for This Lecture N&W Sections I.5.1 and I.5.2 Wolsey Chapter 6 Kozen Lectures 21-25 IE496 Lecture 6 2 Introduction to

More information

Factors, Zeros, and Roots

Factors, Zeros, and Roots Factors, Zeros, and Roots Solving polynomials that have a degree greater than those solved in previous courses is going to require the use of skills that were developed when we previously solved quadratics.

More information

Complexity, P and NP

Complexity, P and NP Complexity, P and NP EECS 477 Lecture 21, 11/26/2002 Last week Lower bound arguments Information theoretic (12.2) Decision trees (sorting) Adversary arguments (12.3) Maximum of an array Graph connectivity

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Design and Analysis of Algorithms CSE 5311 Lecture 25 NP Completeness Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1 NP-Completeness Some

More information

CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal?

CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal? CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal? The conjecture that P is different from NP made its way on to several lists of the most important unsolved problems in Mathematics (never

More information

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch] NP-Completeness Andreas Klappenecker [based on slides by Prof. Welch] 1 Prelude: Informal Discussion (Incidentally, we will never get very formal in this course) 2 Polynomial Time Algorithms Most of the

More information

Algorithms Re-Exam TIN093/DIT600

Algorithms Re-Exam TIN093/DIT600 Algorithms Re-Exam TIN093/DIT600 Course: Algorithms Course code: TIN 093 (CTH), DIT 600 (GU) Date, time: 7th January 2016, 8:30 12:30 Building: M Responsible teacher: Peter Damaschke, Tel. 5405. Examiner:

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms CS245-2015S-23 NP-Completeness and Undecidablity David Galles Department of Computer Science University of San Francisco 23-0: Hard Problems Some algorithms take exponential

More information

CS 583: Algorithms. NP Completeness Ch 34. Intractability

CS 583: Algorithms. NP Completeness Ch 34. Intractability CS 583: Algorithms NP Completeness Ch 34 Intractability Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time? Standard working

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

ECS122A Handout on NP-Completeness March 12, 2018

ECS122A Handout on NP-Completeness March 12, 2018 ECS122A Handout on NP-Completeness March 12, 2018 Contents: I. Introduction II. P and NP III. NP-complete IV. How to prove a problem is NP-complete V. How to solve a NP-complete problem: approximate algorithms

More information

NP-completeness. Chapter 34. Sergey Bereg

NP-completeness. Chapter 34. Sergey Bereg NP-completeness Chapter 34 Sergey Bereg Oct 2017 Examples Some problems admit polynomial time algorithms, i.e. O(n k ) running time where n is the input size. We will study a class of NP-complete problems

More information

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas CSE 417 Introduction to Algorithms Winter 2007 Some Algebra Problems (Algorithmic) Given positive integers a, b, c Question 1: does there exist a positive integer x such that ax = c? NP-Completeness (Chapter

More information

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

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA. Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA NP Completeness Susmita Sur-Kolay Advanced Computing and Microelectronics Unit

More information

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18 601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18 20.1 Introduction Definition 20.1.1 We say that an algorithm runs in polynomial time if its running

More information

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter 2006 NP-Completeness (Chapter 8) Given positive integers a, b, c Question 1: does there exist a positive integer x such that

More information

Honors Advanced Algebra Unit 3: Polynomial Functions October 28, 2016 Task 10: Factors, Zeros, and Roots: Oh My!

Honors Advanced Algebra Unit 3: Polynomial Functions October 28, 2016 Task 10: Factors, Zeros, and Roots: Oh My! Honors Advanced Algebra Name Unit 3: Polynomial Functions October 8, 016 Task 10: Factors, Zeros, and Roots: Oh My! MGSE9 1.A.APR. Know and apply the Remainder Theorem: For a polynomial p(x) and a number

More information

Computational Complexity

Computational Complexity p. 1/24 Computational Complexity The most sharp distinction in the theory of computation is between computable and noncomputable functions; that is, between possible and impossible. From the example of

More information

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms Computer Science 385 Analysis of Algorithms Siena College Spring 2011 Topic Notes: Limitations of Algorithms We conclude with a discussion of the limitations of the power of algorithms. That is, what kinds

More information

COSE215: Theory of Computation. Lecture 20 P, NP, and NP-Complete Problems

COSE215: Theory of Computation. Lecture 20 P, NP, and NP-Complete Problems COSE215: Theory of Computation Lecture 20 P, NP, and NP-Complete Problems Hakjoo Oh 2018 Spring Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 1 / 14 Contents 1 P and N P Polynomial-time reductions

More information

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

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 Summary of the previous lecture Recall that we mentioned the following topics: P: is the set of decision problems (or languages) that are solvable in polynomial time. NP: is the set of decision problems

More information

P, NP, NP-Complete. Ruth Anderson

P, NP, NP-Complete. Ruth Anderson P, NP, NP-Complete Ruth Anderson A Few Problems: Euler Circuits Hamiltonian Circuits Intractability: P and NP NP-Complete What now? Today s Agenda 2 Try it! Which of these can you draw (trace all edges)

More information

SAT, Coloring, Hamiltonian Cycle, TSP

SAT, Coloring, Hamiltonian Cycle, TSP 1 SAT, Coloring, Hamiltonian Cycle, TSP Slides by Carl Kingsford Apr. 28, 2014 Sects. 8.2, 8.7, 8.5 2 Boolean Formulas Boolean Formulas: Variables: x 1, x 2, x 3 (can be either true or false) Terms: t

More information

Outline. 1 NP-Completeness Theory. 2 Limitation of Computation. 3 Examples. 4 Decision Problems. 5 Verification Algorithm

Outline. 1 NP-Completeness Theory. 2 Limitation of Computation. 3 Examples. 4 Decision Problems. 5 Verification Algorithm Outline 1 NP-Completeness Theory 2 Limitation of Computation 3 Examples 4 Decision Problems 5 Verification Algorithm 6 Non-Deterministic Algorithm 7 NP-Complete Problems c Hu Ding (Michigan State University)

More information

DESIGN AND ANALYSIS OF ALGORITHMS. Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

DESIGN AND ANALYSIS OF ALGORITHMS. Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS DESIGN AND ANALYSIS OF ALGORITHMS Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS http://milanvachhani.blogspot.in COMPLEXITY FOR THE IMPATIENT You are a senior software engineer in a large software

More information

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS DESIGN AND ANALYSIS OF ALGORITHMS Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS http://milanvachhani.blogspot.in COMPLEXITY FOR THE IMPATIENT You are a senior software engineer in a large software

More information

Notes for Lecture 21

Notes for Lecture 21 U.C. Berkeley CS170: Intro to CS Theory Handout N21 Professor Luca Trevisan November 20, 2001 Notes for Lecture 21 1 Tractable and Intractable Problems So far, almost all of the problems that we have studied

More information

Class Note #20. In today s class, the following four concepts were introduced: decision

Class Note #20. In today s class, the following four concepts were introduced: decision Class Note #20 Date: 03/29/2006 [Overall Information] In today s class, the following four concepts were introduced: decision version of a problem, formal language, P and NP. We also discussed the relationship

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

Tractable & Intractable Problems

Tractable & Intractable Problems Tractable & Intractable Problems We will be looking at : What is a P and NP problem NP-Completeness The question of whether P=NP The Traveling Salesman problem again Programming and Data Structures 1 Polynomial

More information

Computational Complexity

Computational Complexity Computational Complexity Problems, instances and algorithms Running time vs. computational complexity General description of the theory of NP-completeness Problem samples 1 Computational Complexity What

More information

NP Completeness and Approximation Algorithms

NP Completeness and Approximation Algorithms Winter School on Optimization Techniques December 15-20, 2016 Organized by ACMU, ISI and IEEE CEDA NP Completeness and Approximation Algorithms Susmita Sur-Kolay Advanced Computing and Microelectronic

More information

Intro to Theory of Computation

Intro to Theory of Computation Intro to Theory of Computation LECTURE 24 Last time Relationship between models: deterministic/nondeterministic Class P Today Class NP Sofya Raskhodnikova Homework 9 due Homework 0 out 4/5/206 L24. I-clicker

More information

CSCI3390-Lecture 17: A sampler of NP-complete problems

CSCI3390-Lecture 17: A sampler of NP-complete problems CSCI3390-Lecture 17: A sampler of NP-complete problems 1 List of Problems We now know that if L is any problem in NP, that L P SAT, and thus SAT is NP-hard. Since SAT is also in NP we find that SAT is

More information

Introduction. Pvs.NPExample

Introduction. Pvs.NPExample Introduction Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 09 NP-Completeness (Chapter 34) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu I

More information

NP-Completeness Theory

NP-Completeness Theory NP-Completeness Theory The topics we discussed so far are positive results: Given a problem, how to design efficient algorithms for solving it. NP-Completeness (NPC for sort) Theory is negative results.

More information

Determine the size of an instance of the minimum spanning tree problem.

Determine the size of an instance of the minimum spanning tree problem. 3.1 Algorithm complexity Consider two alternative algorithms A and B for solving a given problem. Suppose A is O(n 2 ) and B is O(2 n ), where n is the size of the instance. Let n A 0 be the size of the

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

NP-Completeness Review

NP-Completeness Review CS124 NP-Completeness Review Where We Are Headed Up to this point, we have generally assumed that if we were given a problem, we could find a way to solve it. Unfortunately, as most of you know, there

More information

NP-Complete Problems and Approximation Algorithms

NP-Complete Problems and Approximation Algorithms NP-Complete Problems and Approximation Algorithms Efficiency of Algorithms Algorithms that have time efficiency of O(n k ), that is polynomial of the input size, are considered to be tractable or easy

More information

Data Structures in Java. Session 22 Instructor: Bert Huang

Data Structures in Java. Session 22 Instructor: Bert Huang Data Structures in Java Session 22 Instructor: Bert Huang http://www.cs.columbia.edu/~bert/courses/33 Announcements Homework 5 solutions posted Homework 6 to be posted this weekend Final exam Thursday,

More information

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

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k. Complexity Theory Problems are divided into complexity classes. Informally: So far in this course, almost all algorithms had polynomial running time, i.e., on inputs of size n, worst-case running time

More information

MAT 210 Test #1 Solutions, Form A

MAT 210 Test #1 Solutions, Form A 1. Where are the following functions continuous? a. ln(x 2 1) MAT 210 Test #1 Solutions, Form A Solution: The ln function is continuous when what you are taking the log of is positive. Hence, we need x

More information

NP-Completeness. ch34 Hewett. Problem. Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g.

NP-Completeness. ch34 Hewett. Problem. Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g. NP-Completeness ch34 Hewett Problem Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g., O(2 n ) computationally feasible poly-time alg. sol. E.g., O(n k ) No

More information

NP-Complete and Non-Computable Problems. COMP385 Dr. Ken Williams

NP-Complete and Non-Computable Problems. COMP385 Dr. Ken Williams NP-Complete and Non-Computable Problems COMP385 Dr. Ken Williams Start by doing what s necessary; then do what s possible; and suddenly you are doing the impossible. Francis of Assisi Our Goal Define classes

More information

NP and Computational Intractability

NP and Computational Intractability NP and Computational Intractability 1 Review Basic reduction strategies. Simple equivalence: INDEPENDENT-SET P VERTEX-COVER. Special case to general case: VERTEX-COVER P SET-COVER. Encoding with gadgets:

More information

Topics in Complexity

Topics in Complexity Topics in Complexity Please evaluate this course on Axess! Your feedback really does make a difference. Applied Complexity Theory Complexity theory has enormous practical relevance across various domains

More information

Polynomial-time reductions. We have seen several reductions:

Polynomial-time reductions. We have seen several reductions: Polynomial-time reductions We have seen several reductions: Polynomial-time reductions Informal explanation of reductions: We have two problems, X and Y. Suppose we have a black-box solving problem X in

More information

Topics in Complexity Theory

Topics in Complexity Theory Topics in Complexity Theory Announcements Final exam this Friday from 12:15PM-3:15PM Please let us know immediately after lecture if you want to take the final at an alternate time and haven't yet told

More information

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1 CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY E. Amaldi Foundations of Operations Research Politecnico di Milano 1 Goal: Evaluate the computational requirements (this course s focus: time) to solve

More information

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

6.080 / Great Ideas in Theoretical Computer Science Spring 2008 MIT OpenCourseWare http://ocw.mit.edu 6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

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

Lecture 24: How to become Famous with P and NP

Lecture 24: How to become Famous with P and NP Lecture 4: How to become Famous with P and NP Agenda for today s class: The complexity class P The complexity class NP NP-completeness The P =? NP problem Major extra-credit problem (due: whenever) Fun

More information

NP-Completeness. Subhash Suri. May 15, 2018

NP-Completeness. Subhash Suri. May 15, 2018 NP-Completeness Subhash Suri May 15, 2018 1 Computational Intractability The classical reference for this topic is the book Computers and Intractability: A guide to the theory of NP-Completeness by Michael

More information

P vs. NP. Data Structures and Algorithms CSE AU 1

P vs. NP. Data Structures and Algorithms CSE AU 1 P vs. NP Data Structures and Algorithms CSE 373-18AU 1 Goals for today Define P, NP, and NP-complete Explain the P vs. NP problem -why it s the biggest open problem in CS. -And what to do when a problem

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

Tractability. Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time?

Tractability. Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time? Tractability Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time?» Standard working definition: polynomial time» On an input

More information

Chapter 8 ~ Quadratic Functions and Equations In this chapter you will study... You can use these skills...

Chapter 8 ~ Quadratic Functions and Equations In this chapter you will study... You can use these skills... Chapter 8 ~ Quadratic Functions and Equations In this chapter you will study... identifying and graphing quadratic functions transforming quadratic equations solving quadratic equations using factoring

More information

Algorithms Design & Analysis. Approximation Algorithm

Algorithms Design & Analysis. Approximation Algorithm Algorithms Design & Analysis Approximation Algorithm Recap External memory model Merge sort Distribution sort 2 Today s Topics Hard problem Approximation algorithms Metric traveling salesman problem A

More information

Math 101 Review of SOME Topics

Math 101 Review of SOME Topics Math 101 Review of SOME Topics Spring 007 Mehmet Haluk Şengün May 16, 007 1 BASICS 1.1 Fractions I know you all learned all this years ago, but I will still go over it... Take a fraction, say 7. You can

More information

Design and Analysis of Algorithms May 12, 2011 Massachusetts Institute of Technology. Practice Final Exam. Problem Title Points Parts Grade Initials

Design and Analysis of Algorithms May 12, 2011 Massachusetts Institute of Technology. Practice Final Exam. Problem Title Points Parts Grade Initials Design and Analysis of Algorithms May 12, 2011 Massachusetts Institute of Technology 6.046J/18.410J Profs. Dana Moshkovitz and Bruce Tidor Practice Final Exam Practice Final Exam Do not open this quiz

More information

Applied Numerical Analysis Quiz #2

Applied Numerical Analysis Quiz #2 Applied Numerical Analysis Quiz #2 Modules 3 and 4 Name: Student number: DO NOT OPEN UNTIL ASKED Instructions: Make sure you have a machine-readable answer form. Write your name and student number in the

More information

8.1 Exponent Properties Involving Products

8.1 Exponent Properties Involving Products 8.1. Exponent Properties Involving Products www.ck12.org 8.1 Exponent Properties Involving Products Learning Objectives Use the product of a power property. Use the power of a product property. Simplify

More information

2 COLORING. Given G, nd the minimum number of colors to color G. Given graph G and positive integer k, is X(G) k?

2 COLORING. Given G, nd the minimum number of colors to color G. Given graph G and positive integer k, is X(G) k? 2 COLORING OPTIMIZATION PROBLEM Given G, nd the minimum number of colors to color G. (X(G)?) DECISION PROBLEM Given graph G and positive integer k, is X(G) k? EQUIVALENCE OF OPTIMAIZTION AND DE- CISION

More information

COP 4531 Complexity & Analysis of Data Structures & Algorithms

COP 4531 Complexity & Analysis of Data Structures & Algorithms COP 4531 Complexity & Analysis of Data Structures & Algorithms Lecture 18 Reductions and NP-completeness Thanks to Kevin Wayne and the text authors who contributed to these slides Classify Problems According

More information

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size.

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size. 10 2.2. CLASSES OF COMPUTATIONAL COMPLEXITY An optimization problem is defined as a class of similar problems with different input parameters. Each individual case with fixed parameter values is called

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

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

CHAPTER 2 POLYNOMIALS KEY POINTS

CHAPTER 2 POLYNOMIALS KEY POINTS CHAPTER POLYNOMIALS KEY POINTS 1. Polynomials of degrees 1, and 3 are called linear, quadratic and cubic polynomials respectively.. A quadratic polynomial in x with real coefficient is of the form a x

More information

COLLEGE ALGEBRA. Paul Dawkins

COLLEGE ALGEBRA. Paul Dawkins COLLEGE ALGEBRA Paul Dawkins Table of Contents Preface... iii Outline... iv Preliminaries... 7 Introduction... 7 Integer Exponents... 8 Rational Exponents...5 Radicals... Polynomials...30 Factoring Polynomials...36

More information

CS Fall 2011 P and NP Carola Wenk

CS Fall 2011 P and NP Carola Wenk CS3343 -- Fall 2011 P and NP Carola Wenk Slides courtesy of Piotr Indyk with small changes by Carola Wenk 11/29/11 CS 3343 Analysis of Algorithms 1 We have seen so far Algorithms for various problems Running

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

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity 1 CS 350 Algorithms and Complexity Fall 2015 Lecture 15: Limitations of Algorithmic Power Introduction to complexity theory Andrew P. Black Department of Computer Science Portland State University Lower

More information

Essential facts about NP-completeness:

Essential facts about NP-completeness: CMPSCI611: NP Completeness Lecture 17 Essential facts about NP-completeness: Any NP-complete problem can be solved by a simple, but exponentially slow algorithm. We don t have polynomial-time solutions

More information

2, or x 5, 3 x 0, x 2

2, or x 5, 3 x 0, x 2 Pre-AP Algebra 2 Lesson 2 End Behavior and Polynomial Inequalities Objectives: Students will be able to: use a number line model to sketch polynomials that have repeated roots. use a number line model

More information

University of Washington March 21, 2013 Department of Computer Science and Engineering CSEP 521, Winter Exam Solution, Monday, March 18, 2013

University of Washington March 21, 2013 Department of Computer Science and Engineering CSEP 521, Winter Exam Solution, Monday, March 18, 2013 University of Washington March 21, 2013 Department of Computer Science and Engineering CSEP 521, Winter 2013 Exam Solution, Monday, March 18, 2013 Instructions: NAME: Closed book, closed notes, no calculators

More information

Admin NP-COMPLETE PROBLEMS. Run-time analysis. Tractable vs. intractable problems 5/2/13. What is a tractable problem?

Admin NP-COMPLETE PROBLEMS. Run-time analysis. Tractable vs. intractable problems 5/2/13. What is a tractable problem? Admin Two more assignments No office hours on tomorrow NP-COMPLETE PROBLEMS Run-time analysis Tractable vs. intractable problems We ve spent a lot of time in this class putting algorithms into specific

More information

To factor an expression means to write it as a product of factors instead of a sum of terms. The expression 3x

To factor an expression means to write it as a product of factors instead of a sum of terms. The expression 3x Factoring trinomials In general, we are factoring ax + bx + c where a, b, and c are real numbers. To factor an expression means to write it as a product of factors instead of a sum of terms. The expression

More information

Lecture 18: P & NP. Revised, May 1, CLRS, pp

Lecture 18: P & NP. Revised, May 1, CLRS, pp Lecture 18: P & NP Revised, May 1, 2003 CLRS, pp.966-982 The course so far: techniques for designing efficient algorithms, e.g., divide-and-conquer, dynamic-programming, greedy-algorithms. What happens

More information

Graduate Algorithms CS F-21 NP & Approximation Algorithms

Graduate Algorithms CS F-21 NP & Approximation Algorithms Graduate Algorithms CS673-2016F-21 NP & Approximation Algorithms David Galles Department of Computer Science University of San Francisco 21-0: Classes of Problems Consider three problem classes: Polynomial

More information

Newton s Method and Linear Approximations

Newton s Method and Linear Approximations Newton s Method and Linear Approximations Curves are tricky. Lines aren t. Newton s Method and Linear Approximations Newton s Method for finding roots Goal: Where is f (x) = 0? f (x) = x 7 + 3x 3 + 7x

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

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

Automata Theory CS Complexity Theory I: Polynomial Time

Automata Theory CS Complexity Theory I: Polynomial Time Automata Theory CS411-2015-17 Complexity Theory I: Polynomial Time David Galles Department of Computer Science University of San Francisco 17-0: Tractable vs. Intractable If a problem is recursive, then

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

CS103 Handout 22 Fall 2012 November 30, 2012 Problem Set 9

CS103 Handout 22 Fall 2012 November 30, 2012 Problem Set 9 CS103 Handout 22 Fall 2012 November 30, 2012 Problem Set 9 In this final problem set of the quarter, you will explore the limits of what can be computed efficiently. What problems do we believe are computationally

More information