Is golden section search better than binary search?

Fixpoint picture Fixpoint · Nov 22, 2010 · Viewed 11.1k times · Source

Recently I've heard an opinion that binary search may be improved by taking by splitting the range by phi (golden ration) instead of by 2. This was a big surprise to me, because I've never heard about such optimization. Is this true? Would this have been true if division by 2 and by phi was equally performant?

If not, are there any general conditions under which golden section search would perform faster than binary search?

UPD: Edited to remove link to a non-relevant Wikipedia article. Sorry for misleading.

Answer

Jason Orendorff picture Jason Orendorff · Nov 22, 2010

There are two algorithms called "Fibonacci search".

The article you linked is about a numerical algorithm for finding the maximum or minimum of certain functions. It is the optimal algorithm for this problem. This problem is just different enough from the binary search problem that it should be obvious for any given case which is appropriate.

The other kind of Fibonacci search does attack the same problem as binary search. Binary search is essentially always better. Knuth writes that Fibonacci search "is preferable on some computers, because it involves only addition and subtraction, not division by 2." But almost all computers use binary arithmetic, in which division by 2 is simpler than addition and subtraction.

(The Wikipedia article currently claims that Fibonacci search could have better locality of reference, a claim Knuth does not make. It could, perhaps, but this is misleading. The tests done by a Fibonacci search are closer together precisely to the extent that they are less helpful in narrowing down the range; on average this would result in more reads from more parts of the table, not fewer. If the records are actually stored on tape, so that seek times dominate, then Fibonacci search might beat binary search—but in that case both algorithms are far from optimal.)