Pink tissue paper. awtri_4c UPDATE_color. Pink tissue paper.
Lower Bounds. Lower bound : an estimate on a minimum amount of work needed to solve a given problem Examples: number of comparisons needed to find the largest element in a set of n numbers number of comparisons needed to sort an array of size n number of comparisons necessary for searching in a sorted array number of multiplications needed to multiply two n -by- n matrices.
Lower Bounds (cont.). Lower bound can be an exact count an efficiency class ( ) Tight lower bound: there exists an algorithm with the same efficiency as the lower bound Problem Lower bound Tightness sorting ( comparison-based ) ( n log n ) yes searching in a sorted array (log n ) yes element uniqueness ( n log n ) yes n -digit integer multiplication ( n ) unknown multiplication of n -by- n matrices ( n 2 ) unknown.
Methods for Establishing Lower Bounds. trivial lower bounds information-theoretic arguments (decision trees) problem reduction ….
Trivial Lower Bounds. Trivial lower bounds : based on counting the number of items that must be processed in input and generated as output Examples finding max element polynomial evaluation sorting element uniqueness.
. Decision Trees. Decision tree — a convenient model of algorithms involving comparisons in which: internal nodes represent comparisons leaves represent outcomes Decision tree for 3-element insertion sort.
. Decision Trees and Sorting Algorithms. Any comparison-based sorting algorithm can be represented by a decision tree ( for each fixed n ) Number of leaves (outcomes) n ! Height of binary tree with n ! leaves log 2 n ! Minimum number of comparisons in the worst case log 2 n ! for any comparison-based sorting algorithm, since the longest path represents the worst case and its length is the height log 2 n ! n log 2 n ( by Sterling approximation ) This lower bound is tight in mergesort.
Lower Bounds by Problem Reduction. Fact: If problem Q can be “reduced” to problem P , then Q is at least as easy as P , or equivalent, P is at least as hard as Q . Reduction from Q to P : Design an algorithm for Q using an algorithm for P as a subroutine. Idea: If problem P is at least as hard as problem Q , then a lower bound for Q is also a lower bound for P. Hence, find problem Q with a known lower bound that can be reduced to problem P in question..
. Classifying Problem Complexity. Is the problem tractable , i.e., is there a polynomial-time (O( p ( n )) algorithm that solves it? Possible answers: yes (n, n log n , n 2 … etc.) no because it’s been proven that no algorithm exists at all because it’s been proven that any algorithm for it would require exponential time.
Problem Types: Optimization and Decision. Optimization problem : find a solution that maximizes or minimizes some objective function Decision problem : answer yes/no to a question Many problems have decision and optimization versions. E.g.: traveling salesman problem optimization : find the cycle of minimum length decision : find the cycle of length L.
Class P. P : the class of decision problems that are solvable in O( p ( n )) time, where p ( n ) is a polynomial of problem’s input size n Examples: searching element uniqueness primality testing.
Class NP. NP (Nondeterministic Polynomial): class of decision problems whose proposed solutions can be verified in polynomial time = solvable by a nondeterministic polynomial algorithm A nondeterministic polpnomial algorithm is an abstract two-stage procedure that: generates a solution of the problem (on some input) by guessing checks whether this solution is correct in polynomial time By definition, it solves the problem if it's capable of generating and verifying a solution on one of its tries.
. Example: CNF satisfiability. Problem: Is a boolean expression in its Conjunctive Normal Form (CNF) satisfiable, i.e., are there values of its variables that make it true? This problem is in NP . Nondeterministic algorithm: Guess a truth assignment Substitute the values into the CNF formula to see if it evaluates to true Example: ( A | ¬B | ¬C ) & ( A | B ) & ( ¬ B | ¬D | E ) & ( ¬D | ¬E ) Truth assignments: A B C D E 0 0 0 0 0 . . . 1 1 1 1 1.
. What other problems are in NP ?. Partition problem: Is it possible to partition a set of n integers into two disjoint subsets with the same sum? Decision versions knapsack problem, and many other combinatorial optimization problems. All the problems in P can also be solved in this manner (but no guessing is necessary), so we have: P NP Big (million dollar) question: P = NP ?.
NP -Complete Problems. A decision problem D is NP -complete if it is as hard as any problem in NP , i.e., D is in NP every problem in NP is polynomial-time reducible to D Cook’s theorem (1971): CNF-satisfiable is NP -complete.
NP -Complete Problems (cont.). Other NP -complete problems obtained through polynomial- time reductions from a known NP -complete problem Examples: TSP, knapsack, partition, and hundreds of other problems of combinatorial nature.
. P = NP ? Dilemma Revisited. P = NP would imply that every problem in NP, including all NP- complete problems, could be solved in polynomial time If a polynomial-time algorithm for just one NP- complete problem is discovered, then every problem in NP can be solved in polynomial time, i.e . P = NP Most, but not all, researchers believe that P NP , i.e. P is a proper subset of NP. If P NP, then the NP-complete problems are not in P, although many of them are very useful in practice..