Algorithm Complexity By: Ashish Patel and Alex Golebiewski.

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

Limitation of Computation Power – P, NP, and NP-complete
What is Intractable? Some problems seem too hard to solve efficiently. Question 1: Does an efficient algorithm exist?  An O(a ) algorithm, where a > 1,
1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell ( )
CPE702 Complexity Classes Pruet Boonma Department of Computer Engineering Chiang Mai University Based on Material by Jenny Walter.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
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.
1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC.
The Theory of NP-Completeness
Analysis of Algorithms CS 477/677
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Chapter 11: Limitations of Algorithmic Power
Complexity Issues Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
P, NP, and NP-Complete Suzan Köknar-Tezel.
NP and NP- Completeness Bryan Pearsaul. Outline Decision and Optimization Problems Decision and Optimization Problems P and NP P and NP Polynomial-Time.
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
NP-Complete Problems CSC 331: Algorithm Analysis NP-Complete Problems.
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.
Lecture 30. P, NP and NP Complete Problems 1. Recap Data compression is a technique to compress the data represented either in text, audio or image form.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
TECH Computer Science NP-Complete Problems Problems  Abstract Problems  Decision Problem, Optimal value, Optimal solution  Encodings  //Data Structure.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
CSE 3813 Introduction to Formal Languages and Automata Chapter 14 An Introduction to Computational Complexity These class notes are based on material from.
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.
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.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
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.)
NP-Complete Problems Algorithm : Design & Analysis [23]
CS10: The Beauty and Joy of Computing Lecture #22 Limits of Computing Warning sign posted at Stern Hall. Also, Apple releases new operating.
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.
CSE 589 Part V One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important. Bertrand Russell.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
CS 461 – Nov. 18 Section 7.1 Overview of complexity issues –“Can quickly decide” vs. “Can quickly verify” Measuring complexity Dividing decidable languages.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
Algorithms for hard problems Introduction Juris Viksna, 2015.
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.
1 Ch 10 - NP-completeness Tractable and intractable problems Decision/Optimization problems Deterministic/NonDeterministic algorithms Classes P and NP.
Optimization/Decision Problems Optimization Problems – An optimization problem is one which asks, “What is the optimal solution to problem X?” – Examples:
Copyright © 2014 Curt Hill Algorithm Analysis How Do We Determine the Complexity of Algorithms.
1 P and NP. 2 Introduction The Traveling Salesperson problem and thousands of other problems are equally hard in the sense that if we had an efficient.
Exhaustive search Exhaustive search is simply a brute- force approach to combinatorial problems. It suggests generating each and every element of the problem.
Conceptual Foundations © 2008 Pearson Education Australia Lecture slides for this course are based on teaching materials provided/referred by: (1) Statistics.
Young CS 530 Ad. Algo. D&A NP-Completeness1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey.
Limitation of Computation Power – P, NP, and NP-complete
NP-Complete Problems.
NP-completeness Ch.34.
Hard Problems Some problems are hard to solve.
EMIS 8373: Integer Programming
Hard Problems Introduction to NP
Analysis and design of algorithm
Approximation Algorithms
Chapter 11 Limitations of Algorithm Power
P, NP and NP-Complete Problems
P, NP and NP-Complete Problems
Our old list of problems
RAIK 283 Data Structures & Algorithms
Lecture 24 Vertex Cover and Hamiltonian Cycle
Presentation transcript:

Algorithm Complexity By: Ashish Patel and Alex Golebiewski

Outline Complexity of Algorithms Complexity Classes Tractable and Intractable Traveling Salesman Problem Knapsack Problem

Complexity of Algorithms The complexity of an algorithms deals with the problem of how much time is required for completion and the amount of space it uses. Measurement is in terms of input size.

Why Complexity is Important log n1 sec3 sec5 sec6 sec n2 sec8 sec32 sec64 sec nlogn2 sec24 sec2.67 min6.4 min n2n2 4 sec64 sec17.07 min1.14 hrs n3n3 8 sec8.53 min9.1 hrs3.03 days 2n2n 4 sec4.27 min1.36 cent5x10 9 cent n!2 sec4.2 hrs8x10 25 cent 4x10 79 cent

Complexity Classes Set of computational problems with the same bounds on time and space. Tractable (solvable in polynomial time) –P Intractable (not solvable in polynomial time) –NP –NP-Complete –NP-Hard Unsolvable (cannot be solved by a computer)

Complexity Classes P Intractable Not solvable NP NP-CompleteNP-Hard

P The set of concrete decision problems that are solvable in polynomial time Problems that include those with reasonably efficient algorithms If a problem is not in P, it will be extremely expensive and probably impossible to solve in practice

NP NP stands for “non-deterministic polynomial” Class of decision problems solved by a non-deterministic polynomial algorithm Non-deterministic polynomial Algorithm –Guess potential solution –Verify solution in polynomial time

NP - Complete NP–complete is the term used to describe decision problems that are the hardest ones in NP in the sense that, if there were a polynomial algorithm for an NP- complete problem, then there would be a polynomial algorithm for every problem in NP. A problem is NP-complete if: –It is in NP and all other problems in NP can be reduced to it in polynomial time An examples of NP-complete problems are the Traveling Salesman, the Knapsack problem, Hamiltonian Circuit, CNF-Satisfiability, etc.

NP - Hard Class of decision problems harder than those that can be solved by a non- deterministic polynomial algorithm If decision version of optimization problem is in NP-Complete, then optimization is NP-Hard

Unsolvable Any problem that cannot be solved by any means through the use of a computer. Example: The Halting problem

Approximation Algorithms An algorithm that seems to work well for the inputs that usually occur. The strategies, or heuristics, used by many of the approximation algorithms are simple and straightforward, yet for some problems they provide surprisingly good results.

Hamiltonian Circuit A Hamiltonian Circuit, in a graph or digraph, is a path (cycle) that starts and ends ate the same vertex and passes through every vertex exactly once Hamiltonian Circuit Problem: Determine whether a given graph has a Hamiltonian Circuit.

Traveling Salesman Problem (TSP) Optimization Problem: Given a weighted graph, find a minimum weighted Hamiltonian Circuit. (NP- Hard) Decision Problem: Given a weighted graph and an integer k, is there a Hamiltonian Circuit with total weight at most k? (NP-complete) This problem is widely known as the Traveling Salesman problem; the salesman wants to minimize total traveling while visiting all the cities in a territory. Other applications include routing trucks for garbage pickup and package deliver. General Solution is of Factorial Complexity

 2  4  3  1 = = 18 1  4  3  2  1 = = 24 1  3  2  4  1 = = 28 Can also be reversed with same cost *** optimal ***

Knapsack Problem Let C = capacity of knapsack (positive) and S = set of objects with assigned “sizes/weights” and “values” (all positive) Optimization Problem: Find the largest valued subset of S that fits in the knapsack of capacity C Decision Problem: Given value K, is there a subset of S that fits in the knapsack of capacity C and has a total value at least K? This problem is mostly exemplified by a robber with a limited size bag stealing items from someone. He wants to get the most value he can inside the bag.

ItemValueWeight TV$ lbs Jewelry$ lbs Clothes$ lbs Piano$ lbs Couch$ lbs ItemValueWeight Piano$ lbs Total=$ lbs T weight = 300lbs ItemValueWeight Couch$ lbs TV$ lbs Jewelry$ lbs Total=$ lbs ItemValueWeight Couch$ lbs TV$ lbs Clothes$ Total=$ lbs *** OPTIMAL***

Applause!!! Clap Clap Clap Clap Clap