# 04-fastexpo - Algorithms Lecture 4: Efficient...

This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Algorithms Lecture 4: Efficient Exponential-Time Algorithms [ Fa10 ] Wouldnt the sentence I want to put a hyphen between the words Fish and And and And and Chips in my Fish-And-Chips sign. have been clearer if quotation marks had been placed before Fish, and between Fish and and, and and and And, and And and and, and and and And, and And and and, and and and Chips, as well as after Chips? 1 Martin Gardner, Aha! Insight (1978) 4 Efficient Exponential-Time Algorithms ? In another lecture note, we discuss the class of NP-hard problems. For every problem in this class, the fastest algorithm anyone knows has an exponential running time. Moreover, there is very strong evidence (but alas, no proof) that it is impossible to solve any NP-hard problem in less than exponential timeits not that were all stupid; the problems really are that hard! Unfortunately, an enormous number of problems that arise in practice are NP-hard; for some of these problems, even approximating the right answer is NP-hard. Suppose we absolutely have to find the exact solution to some NP-hard problem. A polynomial-time algorithm is almost certainly out of the question; the best running time we can hope for is exponential. But which exponential? An algorithm that runs in O ( 1.5 n ) time, while still unusable for large problems, is still significantly better than an algorithm that runs in O ( 2 n ) time! For most NP-hard problems, the only approach that is guaranteed to find an optimal solution is recursive backtracking. The most straightforward version of this approach is to recursively generate all possible solutions and check each one: all satisfying assignments, or all vertex colorings, or all subsets, or all permutations, or whatever. However, most NP-hard problems have some additional structure that allows us to prune away most of the branches of the recursion tree, thereby drastically reducing the running time. 4.1 3SAT Lets consider the mother of all NP-hard problems: 3SAT. Given a boolean formula in conjunctive normal form, with at most three literals in each clause, our task is to determine whether any assignment of values of the variables makes the formula true. Yes, this problem is NP-hard, which means that a polynomial algorithm is almost certainly impossible. Too bad; we have to solve the problem anyway. The trivial solution is to try every possible assignment. Well evaluate the running time of our 3SAT algorithms in terms of the number of variables in the formula, so lets call that n . Provided any clause appears in our input formula at most oncea condition that we can easily enforce in polynomial timethe overall input size is O ( n 3 ) . There are 2 n possible assignments, and we can evaluate each assignment in O ( n 3 ) time, so the overall running time is O ( 2 n n 3 ) ....
View Full Document

## This note was uploaded on 10/14/2011 for the course ECON 101 taught by Professor Smith during the Spring '11 term at West Virginia University Institute of Technology.

### Page1 / 6

04-fastexpo - Algorithms Lecture 4: Efficient...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online