I. Static searchSequential search
Average length of an ordered Table query: Features
1. Semi-query log (n + 1)-1 is only applicable to ordered tables and is limited to sequential storage structures (Linear Linked List cannot perform semi-query .)
2. the average performance of the Fibonacci search O (logn) is better than half, but the worst performance is only required for addition and subtraction when splitting the half difference, this method is applicable to sequential tables with large tables with even keyword distribution, and has better performance than half a fold.
3. Search an index ordered table
Ii. dynamic search
1. Binary sorting tree
The value of the Left subtree is smaller than the value of the right subtree (left small and right big );
The binary linked list is used as the storage structure of the binary sorting tree;
The inserted node must be a leaf node;
The middle-order traversal of the binary sorting tree is an ordered sequence;
The binary sorting tree is similar to the semi-query feature and uses a linked list storage structure. Therefore, it is a suitable expression for dynamic table search;
There are two methods to delete a node. For details, see p230.
The decision tree of a table whose half-length is n is unique, but the Binary Tree Containing N nodes is not unique. The query length is related to the structure of the tree.
The average search length is also O (logn)
2. balanced binary tree
1. The left subtree and the right subtree are both balanced binary trees, and the absolute values of the depth difference between the left subtree and the right subtree do not exceed 1;
The average search length is also O (logn );
3. B-Tree B + tree
4. Key tree (number search tree)
5. Hash table
1. The size of the address set obtained by direct addressing is the same as that of the keyword set. Therefore, different keywords are not conflicted, but are rarely used in practice;
2. Digital Analysis
3. The number of digits in the center after the square of the Chinese and French keywords is the hash address;
4. the folding method divides keywords into several parts with the same digits, and then uses the overlay and (rounding) parts as the hash address;
5. Aside from leaving the remainder, This is the simplest and most commonly used method.
6. the random number method is more appropriate when the keyword length is not equal
How to handle conflicts:
1. Open address Method
2. Hash
3. link address Method
4. Create a public overflow Zone
Hash Table filling factor A = number of records entered in the table N/hash table length m
The average query length of a hash table is a function rather than a function of N. Therefore, no matter how large N is, we can always select an appropriate fill factor to limit the average search length to a specific range.
Search for Data Structures