ArticleslgStudy

mathematics

Fibonacci search technique

Fibonacci search technique is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Fibonacci search technique rather than just read about it. In short: In computer science, the Fibonacci search technique is a method of searching a sorted array using a divide and conquer algorithm that narrows down possible locations with the aid of Fibonacci numbers. The technique is conceptually similar to a binary search, which repeatedly splits the search interval into two equal halves.

Key takeaways

  • Fibonacci search technique belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Fibonacci search technique to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Fibonacci search technique from memory before moving on to harder problems.

Reference excerpt

In computer science, the Fibonacci search technique is a method of searching a sorted array using a divide and conquer algorithm that narrows down possible locations with the aid of Fibonacci numbers. The technique is conceptually similar to a binary search, which repeatedly splits the search interval into two equal halves. Fibonacci search, however, splits the array into two unequal parts, with sizes that are consecutive Fibonacci numbers. This method has a key advantage on older computer hardware where arithmetic division or bit-shifting operations were computationally expensive compared to addition and subtraction. Since the Fibonacci sequence is based on addition, this search method could be implemented more efficiently. While on modern CPUs the performance difference is often negligible, the algorithm remains of theoretical and historical interest. On average, Fibonacci search performs about 4% more comparisons than binary search, and it has an average-case complexity and worst-case complexity of O(log⁡n) (see Big O notation). Fibonacci search can also have an advantage in searching data stored in certain structures, such as on a magnetic tape, where seek times are heavily dependent on the distance from the current head position. It is derived from Golden section search, an algorithm by Jack Kiefer (1953) to search for the maximum or minimum of a unimodal function in an interval.

Algorithm The Fibonacci search technique works by first finding the smallest Fibonacci number that is greater than or equal to the length of the array. Let this Fibonacci number be Fm. The algorithm then uses the preceding Fibonacci numbers, Fm−1 and Fm−2, to probe the array at an index, narrowing the search space in each step. The size of the step decreases at each iteration according to the Fibonacci sequence. Let k be defined as an element in F, the array of Fibonacci numbers. n = Fm is the array size. If n is not a Fibonacci number, let Fm be the smallest number in F that is greater than n. The array of Fibonacci numbers is defined where Fk+2 = Fk+1 + Fk, when k ≥ 0, F1 = 1, and F0 = 1. To test whether an item is in the list of ordered numbers, follow these steps:

Set k = m. If k = 0, stop. There is no match; the item is not in the array. Compare the item against element in Fk−1. If the item matches, stop. If the item is less than entry Fk−1, discard the elements from positions Fk−1 + 1 to n. Set k = k − 1 and return to step 2. If the item is greater than entry Fk−1, discard the elements from positions 1 to Fk−1. Renumber the remaining elements from 1 to Fk−2, set k = k − 2, and return to step 2. Alternative implementation (from "Sorting and Searching" by Knuth):

Given a table of records R1, R2, ..., RN whose keys are in increasing order K1 < K2 < ... < KN, the algorithm searches for a given argument K. Assume N+1= Fk+1 [Initialize] i ← Fk, p ← Fk−1, q ← Fk−2 (throughout the algorithm, p and q will be consecutive Fibonacci numbers) [Compare] If K < Ki, go to Step 3; if K > Ki go to Step 4; and if K = Ki, the algorithm terminates successfully. [Decrease i] If q=0, the algorithm terminates unsuccessfully. Otherwise set (i, p, q) ← (i − q, q, p − q) (which moves p and q one position back in the Fibonacci sequence); then return to Step 2 [Increase i] If p=1, the algorithm terminates unsuccessfully. Otherwise set (i, p, q) ← (i + q, p − q, 2q − p) (which moves p and q two positions back in the Fibonacci sequence); and return to Step 2 The two variants of the algorithm presented above always divide the current interval into a larger and a smaller subinterval. The original algorithm, however, would divide the new interval into a smaller and a larger subinterval in Step 4. This has the advantage that the new i is closer to the old i and is more suitable for accelerating searching on magnetic tape.

Example Suppose we want to search for the number x = 85 in the following sorted array of n = 11 elements: [10, 22, 35, 40, 45, 50, 80, 82, 85, 90, 100]

Find the Fibonacci numbers: The smallest Fibonacci number greater than or equal to n = 11 is F7=13. So, m = 7. The two preceding Fibonacci numbers are F5=5 and F6=8. We will maintain an offset for the subarray we are searching. Initially, offset = -1. First comparison: The first comparison index is i = min(offset + F_6, n-1) = min(-1 + 8, 10) = 7. We compare x with the element at index 7: array[7] is 82. Since x = 85 is greater than 82, we eliminate the elements from the start of the array up to index 7. The new search space is the subarray from index 8 onwards. We update the Fibonacci numbers by moving two steps down: m = m - 2 = 6 (so the new Fibonacci numbers for the step size will be F5=5 and F4=3). We update the offset: offset = i = 7. Second comparison: The next comparison index is i = min(offset + F_4, n-1) = min(7 + 3, 10) = 10. We compare x with the element at index 10: array[10] is 100. Since x = 85 is less than 100, we eliminate the elements from index 10 to the end. We update the Fibonacci numbers by moving one step down: m = m - 1 = 5 (new step sizes will be F4=3 and F3=2). The offset remains offset = 7. Third comparison: The next comparison index is i = min(offset + F_3, n-1) = min(7 + 2, 10) = 9. We compare x with the element at index 9: array[9] is 90. Since x = 85 is less than 90, we eliminate the elements from index 9 to the end. We update the Fibonacci numbers by moving one step down: m = m - 1 = 4 (new step sizes will be F3=2 and F2=1). The offset remains offset = 7. Fourth comparison: The next comparison index is i = min(offset + F_2, n-1) = min(7 + 1, 10) = 8. We compare x with the element at index 8: array[8] is 85. The item is found at index 8. The algorithm terminates successfully.

See also Search algorithms

References

Lourakis, Manolis. "Fibonaccian search in C". Retrieved January 18, 2007. Implements the above algorithm (not Ferguson's original one).

Worked examples

Example 1 — a first encounter with Fibonacci search technique

Start with the simplest possible case. Write down what Fibonacci search technique claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Fibonacci search technique before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Fibonacci search technique ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Fibonacci search technique

In research
Fibonacci search technique appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Fibonacci search technique in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Fibonacci search technique is common in secondary-school and first-year university syllabi. It links to neighbouring topics Fibonacci numbers, Search algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Fibonacci search technique outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Fibonacci search technique” →

How to study Fibonacci search technique in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Fibonacci search technique means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Fibonacci search technique out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Fibonacci search technique in simple terms?

In computer science, the Fibonacci search technique is a method of searching a sorted array using a divide and conquer algorithm that narrows down possible locations with the aid of Fibonacci numbers. The technique is conceptually similar to a binary search, which repeatedly splits the search inter…

Why does Fibonacci search technique matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Fibonacci search technique?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Fibonacci search technique.

Tags

  • Fibonacci numbers
  • Search algorithms

Keep exploring