Limits to Computation How do you analyze a new algorithm? –Put it in the form of existing algorithms that you know the analysis. –For example, given 2.

Slides:



Advertisements
Similar presentations
Limitation of Computation Power – P, NP, and NP-complete
Advertisements

Computability & Complexity. Scenario I can’t write this program because I’m too dumb.
The Theory of NP-Completeness
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
Complexity Theory CSE 331 Section 2 James Daly. Reminders Project 4 is out Due Friday Dynamic programming project Homework 6 is out Due next week (on.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
The Theory of NP-Completeness
P, NP and more.
NP-Complete Problems Problems in Computer Science are classified into
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
Computational Complexity CSC 172 SPRING 2002 LECTURE 27.
Analysis of Algorithms CS 477/677
Computational Complexity, Physical Mapping III + Perl CIS 667 March 4, 2004.
Chapter 11: Limitations of Algorithmic Power
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Halting Problem. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have a tool that would warn us.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Programming & Data Structures
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
MCS312: NP-completeness and Approximation Algorithms
1 CSC 421: Algorithm Design & Analysis Spring 2013 Complexity & Computability  lower bounds on problems brute force, decision trees, adversary arguments,
Chapter 11 Limitations of Algorithm Power. Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples:
CSCE350 Algorithms and Data Structure
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
1 Ethics of Computing MONT 113G, Spring 2012 Session 13 Limits of Computer Science.
1 Joe Meehean.  Log: binary search in sorted array  Linear: traverse a tree  Log-Linear: insert into a heap  Quadratic (N 2 ): your sort from P1 
CSC 413/513: Intro to Algorithms NP Completeness.
CSC 172 P, NP, Etc. “Computer Science is a science of abstraction – creating the right model for thinking about a problem and devising the appropriate.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
Complexity Non-determinism. NP complete problems. Does P=NP? Origami. Homework: continue on postings.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
Cliff Shaffer Computer Science Computational Complexity.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
NP-Complete problems.
Beauty and Joy of Computing Limits of Computing Ivona Bezáková CS10: UC Berkeley, April 14, 2014 (Slides inspired by Dan Garcia’s slides.)
Design and Analysis of Algorithms - Chapter 101 Our old list of problems b Sorting b Searching b Shortest paths in a graph b Minimum spanning tree b Primality.
CS10: The Beauty and Joy of Computing Lecture #22 Limits of Computing Warning sign posted at Stern Hall. Also, Apple releases new operating.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
LIMITATIONS OF ALGORITHM POWER
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
The Beauty and Joy of Computing Lecture #23 Limits of Computing Researchers at Facebook and the University of Milan found that the avg # of “friends” separating.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
CSC 413/513: Intro to Algorithms
Young CS 331 D&A of Algo. NP-Completeness1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and.
Introduction to NP-Completeness Tahir Azim. The Downside of Computers Many problems can be solved in linear time or polynomial time But there are also.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
P, NP, and NP-Complete Problems Section 10.3 The class P consists of all problems that can be solved in polynomial time, O(N k ), by deterministic computers.
1 The Theory of NP-Completeness 2 Review: Finding lower bound by problem transformation Problem X reduces to problem Y (X  Y ) iff X can be solved by.
CSC 172 P, NP, Etc.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
The Theory of NP-Completeness
Limitation of Computation Power – P, NP, and NP-complete
Unsolvable Problems December 4, 2017.
Intro to NP Completeness
Approximation Algorithms
Chapter 11 Limitations of Algorithm Power
Algorithms CSCI 235, Spring 2019 Lecture 36 P vs
Our old list of problems
Presentation transcript:

Limits to Computation How do you analyze a new algorithm? –Put it in the form of existing algorithms that you know the analysis. –For example, given 2 arrays, pair the smallest in each array, the next smallest, etc. –Can be done by sorting each array and pairing first, second, etc. No worse than O(n log n).

Algorithm Reduction But is is possible to do pairings faster than O(n log n)? Look at using pairings for sorting (without using sorting) –The second item of the paired results from pairing will tell us the position of the first item when it is sorted. –If we had a pairing algorithm that was faster than n log n, then we could take an arbitrary array, use an array of the integers 1,.., n So if there is a pairing algorithm of O(n) we can do sorting in O(n). There is a proof that this cannot be done. So pairing must take at least O(n log n).

Hard Problems A hard problem is a problem whose best know algorithm to solve it takes exponential time. A “Hard” Algorithm is a problem that runs in exponential time. It takes  (c n ) for some c>1, where n is the problem size.

NP Problems Assume you have a computer that finds solutions by “guessing” the answer and checks to see if that answer is correct. Could be a super parallel computer that can test all possible solutions simultaneously. If the answer cannot be checked in polynomial time (such as the towers of Hanoi), it is not an NP problem.

NP - Completeness The algorithm using guessing is a nondeterministic algorithm. Hence NP : Nondeterministic polynomial. Some NP problems do not have known efficient deterministic solutions. Every problem in this set reduces to every other problem in this set. If can solve one in polynomial time, can solve them all in polynomial time.

NP- Complete Problems Traveling Salesman K-Clique : given an arbitrary undirected graph, is there a complete subgraph of at least k vertices.

Why know about NP-complete If the best algorithm you can find for your problem is exponential then you may try to find a reduction into a problem that is NP- complete. If you can, then you have shown that whereas your solution has not been shown to be the best, it is very difficult (and maybe impossible) to find a polynomial algorithm.

Heuristic What to do when you must find a solution to an NP-complete problem? –Solve small problems –Solve special cases –Find an approximate solution; one that is good, but not necessarily the best. (I.e., find a short path for the traveling salesman, not necessarily the shortest). Go the to next closest city.

Impossible Problems The halting problem : given an arbitrary program P and the data D, determine (in finite time) if the program P will halt on data D. Can prove that such a program cannot be written

Halting Problem Proof Assume you have a halting program –bool halt(P,D); Write a new program –bool selfhalt(P), calls halt(P, P) –This program will tell if the program P will halt when the input is the program P –P is restricted to programs that take programs as data

Final Step Now write a function : –bool contrary(P){if selfhalt(P) while(TRUE);} What happens when we do –contrary(contrary)? Either contrary –1. Halts, but then it does not halt –2. Does not halt, but then it halts. Contradiction; so cannot write halt.