Overview of Lookup algorithms

Source: Internet
Author: User

In this paper, a summary of the sorting algorithm from the "new data structure exercises and analysis" (Li Chunbao) the 10th chapter.


The object being looked up is a table or file consisting of a set of records, each of which consists of several data items, and assumes that each record has a keyword that uniquely identifies the record.

The lookup is defined as: given a value K, find the record in the table containing n records that the keyword equals K. If found, the lookup succeeds, returns the information of the record or the position of the record in the table, otherwise the lookup fails and returns the relevant instructions.

The relevant factors for finding the method are as follows:

1) Which data structure is used to represent the "table", that is, how the records in the table are organized;

2) The Order of the keywords in the table, that is, the unordered collection lookup or the ordered collection lookup.

If you make modifications to the table at the same time (such as insert and delete), the corresponding table is called the Dynamic Lookup table, otherwise it is called a static lookup table.

There are also search and find-out points in the search. If the entire lookup process is in memory, it is called inner lookup, and conversely, if you need access to external memory during the lookup process, it is called an outer lookup.

Because the primary operation of the lookup operation is a comparison of keywords, the average number of comparisons (also called average lookup lengths) that the keyword needs to perform during the lookup process is often used as a criterion for evaluating the efficiency of a lookup algorithm. Average find length ASL (Average search lengths) is defined as:


where n is the number of records in the lookup table. PI is the probability of finding the first I record, generally, the finding probability of each record is equal, that is, pi=1/n (1<=i<=n), CI is the number of times to find the keyword comparison required for the first record.

The average lookup length is divided into the average lookup length for success and the average lookup length in unsuccessful cases, which refers to the number of times the keyword is to be compared on average for a record in a table, which refers to the average number of times a keyword needs to be compared when a given keyword does not appear in the table.


Overview of Lookup algorithms

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.