Introduction:
Block lookup, also known as index ordered lookup, is an improved method for sequential lookup, with better performance than sequential lookup.
Method description:
Divide n data elements into M Blocks (the average block length is even, and the last block can be less than) (M <= N). Nodes in each block do not have to be ordered, however, the block and block must be "ordered by block". That is, the keywords in the first block must be smaller than (or greater than) the keywords in the second block, and those in the second block must be smaller than (or greater) the keywords in the third part are used to construct the index table. The index table is ordered by the keywords.
As shown in:
The figure below shows an index sequence table, which consists of three blocks. The actual address of the first block is 0, and the maximum keyword is 25. The actual address of the second block is 5, the maximum keyword in the block is 58, the starting address of the third block is 10, and the maximum keyword in the block is 88.
Basic Steps for multipart search:
Step 1. Select the largest keywords in each block to form an index table;
Step 2: The search is divided into two parts: Perform binary search or sequential search on the index table to determine which part of the record to be queried; then, use the sequential method to search for the identified block.
Block lookup/index sequential Lookup