Fibonacci search is a comparison search for a sorted, random-access array. It keeps three consecutive Fibonacci numbers large enough to cover the remaining candidate range. A probe lands at offset + F(k-2); comparing that value with the target discards one side and shifts the Fibonacci triple down without division.

The invariant is that every possible target index is greater than offset and inside the current Fibonacci window. A probe below the target moves offset to the probe. A probe above the target keeps the offset and replaces the window with its smaller left component. Like Binary Search, the method is logarithmic and requires sorted input; the practical distinction is Fibonacci-offset arithmetic rather than repeated midpoint calculation.

Visualization

The trace grows a Fibonacci window that covers the nine values, then probes from an offset initially set before index 0. Each comparison either advances the offset past a proven-small prefix or contracts the live range to the smaller Fibonacci component. A final one-element check handles the remaining candidate after the main window reaches size one.

Complexity
n
number of elements in the sorted array

Boundaries

The array must be sorted under the same comparison used by the search. Unsorted input invalidates the discarded ranges. Random access is also required: Fibonacci search jumps to computed indices and is not a forward-only stream algorithm.

Duplicate targets are safe, but the algorithm returns an arbitrary matching index rather than the first or last occurrence. A lower-bound or upper-bound Binary Search is the direct choice when duplicate boundaries matter. Building the Fibonacci numbers in a wider integer type prevents the covering value from overflowing near the maximum array length.

Questions

References