9-3-Fibonacci search-Chapter 9th-Data Structure textbook source code-yan Weimin Wu Weimin edition, 9-3-Data Structure

Source: Internet
Author: User


9-3-Fibonacci search-Chapter 9th-Data Structure textbook source code-yan Weimin Wu Weimin edition, 9-3-Data Structure


Textbook source code


Chapter 4 search-Fibonacci search


-- Data Structure-yan Weimin. Wu Weimin


Source code instructions☛☛☛Data Structure-C language version (Yan Weimin, Wu Weimin version) Textbook source code + EXERCISE set parsing instructions


Textbook source code compilation Link☛☛☛Data Structure textbook source code compilation


Question set full resolution Link☛☛☛Analysis and compilation of data structure question set




File links introduced in this source code☛Base. c


Test data download link☛Data Packets




Source code and test data storage directory in the document: Data Structure \ ▲textbook Algorithm Implementation \ ▲09 lookup \ 03 FibonacciSearch




Overview

Fibonacci lookup is similar to binary lookup. The difference is that a binary lookup is compared at the midpoint of the upper limit of the lookup range, while a Fibonacci lookup is performed on a Fibonacci shard of the upper limit of the lookup range.


Analysis

The Fibonacci search is divided based on the Fibonacci series based on the binary search. Find a number in the Fibonacci series that is equal to or greater than the number of elements in the query table F [n], and extend the original query table to the length F [n] (if you want to add elements, then, repeat the last element until F [n] elements are satisfied. Then, perform the Fibonacci splitting, that is, F [n] elements are divided into the first half of F [n-1] elements, the second half of F [N-2] elements, find the element to be searched in that Part and recursion, until it is found.


The advantage of the Fibonacci search is that when determining the next comparison element, it can be calculated only by adding or subtracting, which is less time than the division of the binary search.


Source code File 1☛FibonacciSearch. h



File 2☛FibonacciSearch. c



File 3☛FibonacciSearch-main.c (test documentation)



File 4☛TestData_Table.txt (query table test data)



Test Result Display



Updating more chapters...



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.