The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.
algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of ReluctantAlgorithms
From "Pessimal algorithms and the simplexity of computations. A. Broder and J. Stolfi. (Satirical article.) ACM SIGACT News vol. 16 no. 7, 49--53. Fall 1984. [PS,6p,54kB] [bib]" http://www.dcc.unicamp.br/~stolfi/EXPORT/papers/by-tag/bro-sto-84-pes.ps.gz
Another great example is calculation of the FibonacciSequence
. In the PrologLanguage
(if memory serves me):
fibo(N, F) :-
N > 1,
N1 is N - 1,
N2 is N - 2,
F is F1 + F2.
if x < 2:
return fibo(x-1) + fibo(x-2)
Calculating fibo(n) this way takes fibo(n+1) steps! And that would be another way of calculating fibo(n): counting the steps required to calculate fibo(n-1).
This is one of the symptoms/causes of my AnalysisParalysis
and other forms of ChronicProcrastination
I thought the title was going to lead to a joke about Catholicism :-)
See also DivideAndConquer
CategoryAlgorithm CategoryAntiPattern CategoryWhimsy