Go to: Basic Search concepts

Source: Internet
Author: User

From: http://student.zjzk.cn/course_ware/data_structure/web/chazhao/chazhao9.1.1.htm

Introduction to this chapter

Because search operations are frequently used, they are involved in almost any computer system software and application software. Therefore, when the data volume involved in the problem is large, the efficiency of searching methods is particularly important. This is especially true in some real-time query systems. Therefore, this chapter systematically discusses various search methods and compares the advantages and disadvantages of various search methods by analyzing their efficiency.

Basic Search concepts

1. Search for tables and search

Generally, it is assumed that the object to be searched is a table or file composed of a group of nodes, and each node is composed of several data items. Assume that each node has a keyword that uniquely identifies the node.
The search definition is: Given A value K, find the node with the keyword equal to the given value K in the table containing N nodes. If the node is found, the query is successful, and the information of the node or the location of the node in the table is returned. Otherwise, the query fails and related instructions are returned.

2. query the Data Structure Representation of a table
(1) Dynamic and Static search tables
If you modify a table (such as insert or delete) while searching, the corresponding table is called a dynamic searching table. Otherwise, it is called a static query table.

(2) internal search and external search
Similar to sorting, search can also be divided into inner and outer searches. If the entire search process is in the memory, it is called the internal search; otherwise, if the external store needs to be accessed during the search process, it is called the external search.

3. Average search length ASL
The main operation of search operations is the comparison of keywords. Therefore, the average comparison times (also known as the average search length) to be executed for keywords in the search process are used as the criteria to measure the efficiency of a search algorithm.
The average search length ASL (average search length) is defined:

Where:
① N is the number of nodes;
② Pi is the probability of finding the I-th node. If not specifically stated, the search probability of each node is considered equal, that is
PL = P2... = Pn = 1/n
③ Ci is the number of comparisons required to locate the I-th node.
Note:
For simplicity, assume that the type of the keywords in the table is an integer:
Typedef int keytype; // The keytype should be defined by the user.

Go to: Basic Search concepts

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.