Fibonacci Search
A comparison-based technique that uses Fibonacci numbers to divide the search space, avoiding costly division operators utilized in Binary or Interpolation search.
Parameters
Visualization
Step: 0Algorithm Insight
Finds the target using Fibonacci sequence intervals:
-
1.
Calculate probe position (
pos) via the formula. -
2.
If
arr[pos] == target, search is complete! -
3.
If smaller, shift fib numbers down 1 step &
offset = pos. If larger, shift fib numbers down 2 steps.
Efficiency
Overview
First choose a Fibonacci number at least as large as the array length. Probe at an offset based on a smaller Fibonacci number, compare the target with that value, and discard the range that cannot contain it. Then use the next smaller Fibonacci offsets for the remaining range.