12.4 Linear Reductions

When we consider the problem of sorting a list, we can put together our knowledge of algorithmics and computational complexity to get a very satisfying result:

We know algorithms such as heapsort, quicksort, and mergesort which have (at least) average performance that is Θ(N*log(N)). Furthermore, we know that there are no better comparision-based algorithms (in the big-O sense) because any comparison-based sort has a worst case that is Ω(N*log(N)).

(Computer) science does not have the means to determine so well the inherent complexity of most problems we meet in practice.

Doing the best we can, we compare the relative complexity of sets of problems.

We say problem X reduces to problem Y if we can efficiently transform instances of problem X into instances of problem Y in such a way that solving the transformed instance yields the answer to the original instance.

By grouping together problems in this way, we establish "equivalence classes" of problems. If the time comes when we discover a way to solve one of the problems in a class more efficiently, then maybe we will know how to solve all of them more efficiently.

In section 10.7.4 there is a discussion of the fact that "splitting + primality testing" and "factorization" each are reducible to the other. Factorization is the problem of finding the (unique) decomposition of an integer N into a product of primes. Splitting is the problem of finding a non-trivial factor of a composite (non-prime) integer M. Primality testing is, of course, the problem of determining whether a given integer X is a prime.

Brassard and Bratley point out that there is an O(N*log(N)*log(log(N))) algorithm (due to Schonhage and Strassen) for multiplying two N-bit integers.

No one knows if an O(N) algorithm can be devised for multiplying two N-bit integers. No one knows if an O(N) algorithm can be devised for squaring two N-bit integers.

However, since

x2 = x*x and x*y = [(x+y)2-(x-y)2]/4,

we do know that "multiplying integers" reduces to "squaring integers", and vice-versa. Thus if we find an O(N) way to square N-bit integers, we know how to apply it to get an O(N) algorithm for multiplying arbitrary pairs of N-bit integers.

Brassard and Bratley also note in this section that "under reasonable assumptions, it takes the same time to multiply two n-figure numbers, to compute the quotient when a 2n-figure number is divided by an n-figure number, and to compute the integer part of the square root of an n-figure number.