INFO 150: A Mathematical Foundation for Informatics

David Mix Barrington

Fall, 2017

Lecture #9, 27 September 2017

Brute-Force Search

In Lecture #2 we studied a variety of sequences of numbers, which can be thought of as functions that assign a number f(n) to each natural n. We saw constant, linear, quadratic, exponential, and factorial sequences.

Such sequences are important in the study of computation because they can model the time complexity of an algorithm. If we have a measure of the size of an algorithm's input, we can measure the number of steps that the algorithm takes on the worst input of that size. For example, you will later learn sorting algorithms that can sort a list of n items in about n times log n time. And the truth table method, on a compound proposition with n variables, needs 2n lines and thus over 2n steps to determine whether the formula is a tautology.

On the homework you'll take some values of n and some potential time functions, and determine the running time of the algorithms on these input sizes, on the assumption that your computer can perform a billion steps in one second.

We've seen that in some cases we can show a compound proposition to be a tautology without checking all 2n possible settings. But there is no known way to find a proof of this form for an arbitrary tautology that takes a polynomial number of steps (nk steps for some constant k). In fact, it is not known whether such a short proof always exists for an arbitrary tautology.

But there are cases where we know algorithms that are a great improvement on brute-force search, and you will see these if you ever take an algorithms course:

However, there are many other searching problems where no method is known that is much better than brute-force search, at least in the worst case. Some of these algorithm have a property called NP-completeness, which means that if they can be solved in polynomial time, essentially all brute force searches can be carried out in polynomial time. It seems unlikely that such a general search algorithm exists, but to prove that it doesn't (assuming that it really doesn't) is currently the greatest unsolved problem in theoretical computer science and one of the greatest in all of mathematics. Here are a few examples of NP-complete problems:

A working programmer should have an idea of what sort of search problems have known solutions and which are NP-complete. In addition, there are practical approaches to some NP-complete problems, such as restricting to special cases, or looking for an approximation an optimal solution instead of an exact solution.

Last modified 28 September 2017