CN101127052A - Sequential chained list node quick searching method and device - Google Patents

Sequential chained list node quick searching method and device Download PDF

Info

Publication number
CN101127052A
CN101127052A CNA2007101615094A CN200710161509A CN101127052A CN 101127052 A CN101127052 A CN 101127052A CN A2007101615094 A CNA2007101615094 A CN A2007101615094A CN 200710161509 A CN200710161509 A CN 200710161509A CN 101127052 A CN101127052 A CN 101127052A
Authority
CN
China
Prior art keywords
node
chained list
list
sequential chained
key value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CNA2007101615094A
Other languages
Chinese (zh)
Inventor
蒋敏
张纪金
张兆元
伍慧敏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CNA2007101615094A priority Critical patent/CN101127052A/en
Publication of CN101127052A publication Critical patent/CN101127052A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The utility model relates to a fast node searching method and a device from an orderly chained list, which mainly comprising following steps: firstly, a small amount of nodes are chosen as index nodes from the orderly chained list based on proper rules. An index table is prepared, and then gradually compares key values of object node and all indexed nodes in the index table scanning for the object index node. Then, the position of the object index node in the orderly chained list can be determined through the indication of object index node pointer in the orderly chained list nodes. At last in the orderly chained list, gradually compare the key values of the object node and all nodes around the position exposed scanning for the object node. The object node in the orderly chained list can be searched rapidly and effectively by using the method and device.

Description

A kind of method for fast searching of sequential chained list node and device
Technical field
The present invention relates to the search technique of sequential chained list node, refer in particular to a kind of method for fast searching and device of sequential chained list node.
Background technology
In computer software design, sequential chained list is a kind of data store organisation of frequent use, the binary tree that this data structure is higher with respect to search efficiency, ternary tree etc. have characteristics such as programming is simple, debugging is convenient, be subjected to liking of numerous developers, the inquiry of sequential chained list, insertion, deletion all relate to the operation that a large amount of key value (being the value in sort key territory) is searched in sequential chained list.
Fig. 1 is the searching method synoptic diagram of sequential chained list node in the prior art, as shown in the figure: since a node (being generally the head node of sequential chained list), the key value of each node in the key value of destination node and the sequential chained list is compared seriatim, finally in sequential chained list, search appropriate nodes, be destination node, finish the search procedure in sequential chained list.
This searching method is owing to need compare the key value of destination node and the key value of each node one by one, therefore processing speed is very slow, influenced the performance of CPU, especially in embedded system, cpu performance is generally relatively poor, internal memory is also quite deficient, seeks a kind of fast, efficiently, and take the little destination node searching method of extra memory and seem particularly important.
Summary of the invention
In view of this, method for fast searching and device that fundamental purpose of the present invention is to provide a kind of sequential chained list node utilize this method and device, can search destination node fast and efficiently in sequential chained list.
For achieving the above object, technical scheme of the present invention is achieved in that
A kind of method for fast searching of sequential chained list node, this method mainly may further comprise the steps:
A, in sequential chained list, choose node, described node as index node, is set up concordance list according to setting rule;
B, in concordance list, search the target index node;
C, by target index node ferret out node in sequential chained list.
Wherein, the number ratio of all nodes is 1: 100 in the number of described index node and the sequential chained list.
At least comprise in the described concordance list that described index node points to the pointer of the node of described sequential chained list, the key value of described index node.
In the described concordance list index node put in order with sequential chained list in node put in order consistent.
Described concordance list is array or chained list.
Further, described step B is: the key value of the key value of destination node and each index node is carried out one by one comparison search to the target index node.
Preferably, described step C is: the pointer by target index node directional ordering chained list node is determined the position of index node in sequential chained list, the key value of the key value of destination node and near each node the described position is carried out one by one comparison search then in sequential chained list to destination node.
Node inserts, when deleting, upgrades concordance list itself and sequential chained list are kept synchronously in sequential chained list.
A kind of quick searcher of sequential chained list node, this device comprise sets up indexing units and search unit, wherein,
Set up indexing units, be used for from sequential chained list, choosing node, and described node sequence as index node, set up concordance list;
Search unit is used for searching in concordance list and sequential chained list successively, finally searches destination node.
Further, described search unit comprises index node search module and node searching module, wherein,
The index node search module, being used in concordance list key value with the key value of destination node and each index node carries out one by one comparison search to the target index node, and the target index node is sent to the node searching module;
The node searching module, be used for determining the position of index node in sequential chained list, in sequential chained list, the key value of the key value of destination node and near each node this position carried out one by one comparison search then to destination node according to the pointer of described target index node directional ordering chained list node.
Utilize the present invention, following characteristics and advantage arranged:
1, in search time, at first carried out the key value of the key value of destination node and each index node one by one comparison search to from searching the nearest index node of destination node in concordance list, it is the target index node, pass through the pointer of the sequential chained list node of target index node sensing again and in sequential chained list, determine the position of index node in sequential chained list, in sequential chained list, the key value of the key value of destination node and near each node this position carried out one by one comparison search then to destination node, whole search procedure fast, efficient.
2, when the ratio of the number of index node in the concordance list and the interstitial content in the sequential chained list is very little, it will be very little increasing the shared internal memory of concordance list, so just can take the very high search speed of acquisition under the very little situation of extra memory, be well suited for the embedded system that cpu performance is relatively poor, internal memory is also quite deficient.
Description of drawings
Fig. 1 is the searching method synoptic diagram of sequential chained list node in the prior art;
Fig. 2 is the method for fast searching synoptic diagram of sequential chained list node among the present invention;
Fig. 3 is the searching method schematic flow sheet of sequential chained list node among the present invention.
Embodiment
The present invention is further detailed explanation below in conjunction with accompanying drawing:
Fig. 2 is the searching method schematic flow sheet of sequential chained list node among the present invention for the method for fast searching synoptic diagram of sequential chained list node among the present invention, Fig. 3, as Fig. 2, shown in Figure 3,
Realization of the present invention mainly is divided into the two large divisions:
First: set up concordance list.
Step 301, set up concordance list.
In sequential chained list, choose small number of nodes according to setting rule, these nodes of choosing as index node, set up concordance list (can be array, chained list etc.), then this index node should comprise the pointer of directional ordering chained list node and the key value of this index node at least.The key value of index node refers to from big to small or the from small to large value in the sort key territory of ordering of node in the sequential chained list, and such as the chained list of an age-based ordering, everyone age is exactly the key value of this sequential chained list node.Concordance list and sequential chained list are separate.
Here, set rule and be meant, both can begin sequential chained list, equally spaced to choose index node, also can begin sequential chained list, to choose index node unequal interval from head node from head node.
Wherein, concordance list must be orderly, i.e. lifting with sequential chained list is consistent in proper order.
And in order to improve search efficiency, the index node of choosing from sequential chained list should be evenly distributed in the sequential chained list as far as possible, and the number of the index node of choosing (N) should be far smaller than the interstitial content (M) of sequential chained list.So both improved search efficiency, reduced the internal memory that index node takies again, particularly important in the embedded system of internal memory anxiety, the ratio suggestion of N: M was greater than 1: 100, the ratio of the number of index node and the interstitial content in the sequential chained list is more little in the concordance list, the shared extra memory of concordance list is more little, and search efficiency is high more, so just can take the very high search speed of acquisition under the very little situation of extra memory, be well suited for the embedded system that cpu performance is relatively poor, internal memory is also quite deficient.
In addition, from sequential chained list, select the rule of index node according to circumstances to make a concrete analysis of.For example, when the key value span of node is divided into several groups that do not wait at interval in the sequential chained list, can in these several groups, chooses the node of a key value minimum in each group and set up concordance list; When the key value span of node in the orderly chained list is divided into several groups that equate at interval, also can in these several groups, chooses the node of a key value minimum in each group and set up concordance list.
Second portion: search fast.
Step 302, in concordance list, the key value of the key value of destination node and each index node carried out one by one comparison search to the target index node.
In concordance list, the key value of destination node and the key value of each index node are compared one by one, search from searching the nearest index node of destination node, i.e. target index node.
Step 303, determine the position of index node in sequential chained list, in sequential chained list, the key value of the key value of destination node and near each node this position carried out one by one comparison search then to destination node by the pointer of target index node directional ordering chained list node.
Whole search procedure is than prior art, do not need the key value of destination node and the key value of each node are compared one by one, but in concordance list, search from searching the nearest index node of destination node earlier, it is the target index node, determine the position of index node in sequential chained list by the pointer of target index node directional ordering chained list node then, in sequential chained list, search destination node then, this shows, search speed is very fast, and efficient improves a lot.
Will upgrade concordance list according to actual conditions when node inserts, deletes in sequential chained list keeps synchronously itself and sequential chained list.For example, after increase or deleting N time, once with the some or all of renewal of concordance list.Perhaps, if the node of deletion just is an index node, need be a last node of this node or next node as index node, and with the information updatings such as key value of its pointer, index node in concordance list.
For realizing said method, the present invention adopts as lower device, and this device comprises sets up indexing units and search unit, wherein,
Set up indexing units, be used for from sequential chained list, choosing node, and described node sequence as index node, set up concordance list;
Search unit is used for searching in concordance list and sequential chained list successively, finally searches destination node.
And described search unit comprises index node search module and node searching module again, wherein,
The index node search module, being used in concordance list key value with the key value of destination node and each index node carries out one by one comparison search to the target index node, and the target index node is sent to the node searching module;
The node searching module, be used for the target index node that reception hint node searching module sends over, and determine the position of index node in sequential chained list by the pointer of target index node directional ordering chained list node, in sequential chained list, the key value of the key value of destination node and near each node this position carried out one by one comparison search then to destination node.
Below in conjunction with specific embodiment realization of the present invention is described in further detail:
First embodiment: be divided into A (0~1000) such as the key value span that a sequential chained list is arranged, B (4000~6000), three groups of C (8000~10000), in these three groups, choose the node of respectively organizing a key value minimum and set up concordance list, promptly in sequential chained list, choose the pairing node of 0,4000,8000 these key values as index node, set up concordance list.
Second embodiment: choosing sequence number in sequential chained list is 0, K, and 2K.。。。。。, the node of nK is set up concordance list (wherein: K=M/N) as index node.
Suppose that a sequential chained list has 5000 nodes, needs search sequence number is 2030 node.According to traditional way that compares one by one from the sequential chained list gauge outfit, need carry out more just finding for 2030 times the node that needs.
Suppose that we are chained list sequence number 0,100,200.。。。。。, the node of n*100 has been set up index, and promptly choosing K is 1 00, then finds the sequence number that needs and be the number of comparisons that 2030 node need carry out to be: (2000/100+30)=50 time.Utilize the present invention to make the search efficiency of sequential chained list node that huge raising arranged as can be seen, improved about 40 times herein.When the value of K, when promptly the ratio of M/N increased, search efficiency will be higher.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.

Claims (10)

1. the method for fast searching of a sequential chained list node is characterized in that, this method mainly may further comprise the steps:
A, in sequential chained list, choose node, described node as index node, is set up concordance list according to setting rule;
B, in concordance list, search the target index node;
C, by target index node ferret out node in sequential chained list.
2. method according to claim 1 is characterized in that, the number ratio of all nodes is 1: 100 in the number of described index node and the sequential chained list.
3. method according to claim 1 is characterized in that, comprises at least in the described concordance list that described index node points to the pointer of the node of described sequential chained list, the key value of described index node.
4. method according to claim 1 is characterized in that, in the described concordance list index node put in order with sequential chained list in node put in order consistent.
5. method according to claim 1 is characterized in that, described concordance list is array or chained list.
6. method according to claim 1 is characterized in that, described step B is: the key value of the key value of destination node and each index node is carried out one by one comparison search to the target index node.
7. according to the arbitrary described method of claim 1 to 6, it is characterized in that, described step C is: the pointer by target index node directional ordering chained list node is determined the position of index node in sequential chained list, the key value of the key value of destination node and near each node the described position is carried out one by one comparison search then in sequential chained list to destination node.
8. method according to claim 1 is characterized in that, this method further comprises: node inserts, when deleting, upgrades concordance list itself and sequential chained list are kept synchronously in sequential chained list.
9. the quick searcher of a sequential chained list node is characterized in that, this device comprises sets up indexing units and search unit, wherein,
Set up indexing units, be used for from sequential chained list, choosing node, and described node sequence as index node, set up concordance list;
Search unit is used for searching in concordance list and sequential chained list successively, finally searches destination node.
10. device according to claim 9 is characterized in that, described search unit comprises index node search module and node searching module, wherein,
The index node search module, being used in concordance list key value with the key value of destination node and each index node carries out one by one comparison search to the target index node, and the target index node is sent to the node searching module;
The node searching module, be used for determining the position of index node in sequential chained list, in sequential chained list, the key value of the key value of destination node and near each node this position carried out one by one comparison search then to destination node according to the pointer of described target index node directional ordering chained list node.
CNA2007101615094A 2007-09-24 2007-09-24 Sequential chained list node quick searching method and device Pending CN101127052A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNA2007101615094A CN101127052A (en) 2007-09-24 2007-09-24 Sequential chained list node quick searching method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNA2007101615094A CN101127052A (en) 2007-09-24 2007-09-24 Sequential chained list node quick searching method and device

Publications (1)

Publication Number Publication Date
CN101127052A true CN101127052A (en) 2008-02-20

Family

ID=39095083

Family Applications (1)

Application Number Title Priority Date Filing Date
CNA2007101615094A Pending CN101127052A (en) 2007-09-24 2007-09-24 Sequential chained list node quick searching method and device

Country Status (1)

Country Link
CN (1) CN101127052A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102075315A (en) * 2010-11-24 2011-05-25 中兴通讯股份有限公司 Data synchronization method and device among forwarding boards
CN104636349A (en) * 2013-11-07 2015-05-20 阿里巴巴集团控股有限公司 Method and equipment for compression and searching of index data
CN107665409A (en) * 2017-11-01 2018-02-06 飞友科技有限公司 A kind of front and rear sequence flight structure and fault-tolerant method

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102075315A (en) * 2010-11-24 2011-05-25 中兴通讯股份有限公司 Data synchronization method and device among forwarding boards
CN102075315B (en) * 2010-11-24 2014-08-13 中兴通讯股份有限公司 Data synchronization method and device among forwarding boards
CN104636349A (en) * 2013-11-07 2015-05-20 阿里巴巴集团控股有限公司 Method and equipment for compression and searching of index data
CN104636349B (en) * 2013-11-07 2018-05-22 阿里巴巴集团控股有限公司 A kind of index data compression and the method and apparatus of index data search
CN107665409A (en) * 2017-11-01 2018-02-06 飞友科技有限公司 A kind of front and rear sequence flight structure and fault-tolerant method
CN107665409B (en) * 2017-11-01 2021-02-26 飞友科技有限公司 Method for constructing and fault-tolerant front-and-back flight

Similar Documents

Publication Publication Date Title
Ding et al. Tsunami: A learned multi-dimensional index for correlated data and skewed workloads
KR101938953B1 (en) Flash optimized columnar data layout and data access algorithms for big data query engines
Zhang et al. Adapting skyline computation to the mapreduce framework: Algorithms and experiments
Zou et al. Pareto-based dominant graph: An efficient indexing structure to answer top-k queries
US8943091B2 (en) System, method, and computer program product for performing a string search
US11132383B2 (en) Techniques for processing database tables using indexes
CN103914483B (en) File memory method, device and file reading, device
CN105117417A (en) Read-optimized memory database Trie tree index method
CN102890722A (en) Indexing method applied to time sequence historical database
US10545915B2 (en) Recursive multi-threaded file system scanner for serializing file system metadata exoskeleton
CN104361113A (en) OLAP (On-Line Analytical Processing) query optimization method in memory and flesh memory hybrid storage mode
Zhang et al. cublastp: Fine-grained parallelization of protein sequence search on cpu+ gpu
CN108460123B (en) High-dimensional data retrieval method, computer device, and storage medium
CN104346384A (en) Method and device for processing small files
CN105740264A (en) Distributed XML database sorting method and apparatus
CN103064841A (en) Retrieval device and retrieval method
EP3955256A1 (en) Non-redundant gene clustering method and system, and electronic device
Qin et al. Asymmetric signature schemes for efficient exact edit similarity query processing
CN101127052A (en) Sequential chained list node quick searching method and device
CN104657513A (en) File operation and rapid retrieval method in embedded system
Cossentine et al. Fast sorting on flash memory sensor nodes
CN104750846A (en) Method and device for finding substring
Zhang et al. An optimized query index method based on R-tree
CN109241098B (en) Query optimization method for distributed database
Cossentine et al. Efficient external sorting on flash memory embedded devices

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Open date: 20080220